Skip to content

Commit c76a5ed

Browse files
authored
Merge pull request MyIntervals#192 from open-source-contributions/test_enhancement
Test enhancement
2 parents bfdd976 + 5e42c58 commit c76a5ed

File tree

11 files changed

+26
-21
lines changed

11 files changed

+26
-21
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ php:
77
- "7.1"
88
- "7.2"
99
- "7.3"
10+
- "7.4"
1011
- hhvm-3.30
1112
sudo: false
1213
dist: trusty
@@ -19,4 +20,3 @@ matrix:
1920
before_script: rm composer.lock && composer install
2021
script: ./vendor/bin/phpunit --coverage-clover build/coverage/xml
2122
after_script: ./vendor/bin/codacycoverage clover build/coverage/xml
22-

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
"php": ">=5.3.2"
1313
},
1414
"require-dev": {
15-
"phpunit/phpunit": "~4.8",
15+
"phpunit/phpunit": "^4.8.36",
1616
"codacy/coverage": "^1.4"
1717
},
1818
"autoload": {
19-
"psr-0": { "Sabberworm\\CSS\\": "lib/" }
19+
"psr-4": { "Sabberworm\\CSS\\": "lib/Sabberworm/CSS/" }
2020
}
2121
}

phpunit.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,10 @@
77
<directory>tests</directory>
88
</testsuite>
99
</testsuites>
10+
11+
<filter>
12+
<whitelist>
13+
<directory suffix=".php">lib/Sabberworm/CSS</directory>
14+
</whitelist>
15+
</filter>
1016
</phpunit>

tests/Sabberworm/CSS/CSSList/AtRuleBlockListTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Sabberworm\CSS\Parser;
66

7-
class AtRuleBlockListTest extends \PHPUnit_Framework_TestCase {
7+
class AtRuleBlockListTest extends \PHPUnit\Framework\TestCase {
88

99
public function testMediaQueries() {
1010
$sCss = '@media(min-width: 768px){.class{color:red}}';

tests/Sabberworm/CSS/CSSList/DocumentTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Sabberworm\CSS\Parser;
66

7-
class DocumentTest extends \PHPUnit_Framework_TestCase {
7+
class DocumentTest extends \PHPUnit\Framework\TestCase {
88

99
public function testOverrideContents() {
1010
$sCss = '.thing { left: 10px; }';

tests/Sabberworm/CSS/OutputFormatTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
2525
EOT;
2626

27-
class OutputFormatTest extends \PHPUnit_Framework_TestCase {
27+
class OutputFormatTest extends \PHPunit\Framework\TestCase {
2828
private $oParser;
2929
private $oDocument;
3030

tests/Sabberworm/CSS/ParserTest.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use Sabberworm\CSS\Value\URL;
1111
use Sabberworm\CSS\Parsing\UnexpectedTokenException;
1212

13-
class ParserTest extends \PHPUnit_Framework_TestCase {
13+
class ParserTest extends \PHPunit\Framework\TestCase {
1414

1515
function testFiles() {
1616
$sDirectory = dirname(__FILE__) . '/../../files';
@@ -223,23 +223,23 @@ function testManipulation() {
223223
$this->assertSame('#header {margin: 10px 2em 1cm 2%;color: red !important;frequency: 30Hz;}
224224
body {color: green;}', $oDoc->render());
225225
}
226-
226+
227227
function testRuleGetters() {
228228
$oDoc = $this->parsedStructureForFile('values');
229229
$aBlocks = $oDoc->getAllDeclarationBlocks();
230230
$oHeaderBlock = $aBlocks[0];
231231
$oBodyBlock = $aBlocks[1];
232232
$aHeaderRules = $oHeaderBlock->getRules('background-');
233-
$this->assertSame(2, count($aHeaderRules));
233+
$this->assertCount(2, $aHeaderRules);
234234
$this->assertSame('background-color', $aHeaderRules[0]->getRule());
235235
$this->assertSame('background-color', $aHeaderRules[1]->getRule());
236236
$aHeaderRules = $oHeaderBlock->getRulesAssoc('background-');
237-
$this->assertSame(1, count($aHeaderRules));
238-
$this->assertSame(true, $aHeaderRules['background-color']->getValue() instanceof \Sabberworm\CSS\Value\Color);
237+
$this->assertCount(1, $aHeaderRules);
238+
$this->assertTrue($aHeaderRules['background-color']->getValue() instanceof \Sabberworm\CSS\Value\Color);
239239
$this->assertSame('rgba', $aHeaderRules['background-color']->getValue()->getColorDescription());
240240
$oHeaderBlock->removeRule($aHeaderRules['background-color']);
241241
$aHeaderRules = $oHeaderBlock->getRules('background-');
242-
$this->assertSame(1, count($aHeaderRules));
242+
$this->assertCount(1, $aHeaderRules);
243243
$this->assertSame('green', $aHeaderRules[0]->getValue());
244244
}
245245

@@ -328,7 +328,7 @@ function testNamespaces() {
328328
|test {gaga: 2;}';
329329
$this->assertSame($sExpected, $oDoc->render());
330330
}
331-
331+
332332
function testInnerColors() {
333333
$oDoc = $this->parsedStructureForFile('inner-color');
334334
$sExpected = 'test {background: -webkit-gradient(linear,0 0,0 bottom,from(#006cad),to(hsl(202,100%,49%)));}';
@@ -368,21 +368,21 @@ function testListValueRemoval() {
368368
$this->assertSame('@media screen {html {some: -test(val2);}}
369369
#unrelated {other: yes;}', $oDoc->render());
370370
}
371-
371+
372372
/**
373373
* @expectedException Sabberworm\CSS\Parsing\OutputException
374374
*/
375375
function testSelectorRemoval() {
376376
$oDoc = $this->parsedStructureForFile('1readme');
377377
$aBlocks = $oDoc->getAllDeclarationBlocks();
378378
$oBlock1 = $aBlocks[0];
379-
$this->assertSame(true, $oBlock1->removeSelector('html'));
379+
$this->assertTrue($oBlock1->removeSelector('html'));
380380
$sExpected = '@charset "utf-8";
381381
@font-face {font-family: "CrassRoots";src: url("../media/cr.ttf");}
382382
body {font-size: 1.6em;}';
383383
$this->assertSame($sExpected, $oDoc->render());
384-
$this->assertSame(false, $oBlock1->removeSelector('html'));
385-
$this->assertSame(true, $oBlock1->removeSelector('body'));
384+
$this->assertFalse($oBlock1->removeSelector('html'));
385+
$this->assertTrue($oBlock1->removeSelector('body'));
386386
// This tries to output a declaration block without a selector and throws.
387387
$oDoc->render();
388388
}

tests/Sabberworm/CSS/RuleSet/DeclarationBlockTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use Sabberworm\CSS\Rule\Rule;
77
use Sabberworm\CSS\Value\Size;
88

9-
class DeclarationBlockTest extends \PHPUnit_Framework_TestCase {
9+
class DeclarationBlockTest extends \PHPUnit\Framework\TestCase {
1010

1111
/**
1212
* @dataProvider expandBorderShorthandProvider

tests/Sabberworm/CSS/RuleSet/LenientParsingTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Sabberworm\CSS\Parser;
66
use Sabberworm\CSS\Settings;
77

8-
class LenientParsingTest extends \PHPUnit_Framework_TestCase {
8+
class LenientParsingTest extends \PHPUnit\Framework\TestCase {
99

1010
/**
1111
* @expectedException Sabberworm\CSS\Parsing\UnexpectedTokenException

tests/bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
require $file;
88
return true;
99
}
10-
});
10+
});

tests/quickdump.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,3 @@
1717
print $oDoc->render();
1818

1919
echo "\n```\n";
20-

0 commit comments

Comments
 (0)