Skip to content

Commit 2af5580

Browse files
author
Cody Finegan
committed
Upgrading to PHPUnit 9
1 parent 2141f50 commit 2af5580

File tree

6 files changed

+44
-32
lines changed

6 files changed

+44
-32
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"ext-iconv": "*"
2020
},
2121
"require-dev": {
22-
"phpunit/phpunit": "^4.8.36",
23-
"codacy/coverage": "^1.4"
22+
"codacy/coverage": "^1.4",
23+
"phpunit/phpunit": "^9.5"
2424
},
2525
"suggest": {
2626
"ext-mbstring": "for parsing UTF-8 CSS"

phpunit.xml

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
<phpunit
2-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/4.8/phpunit.xsd">
4-
<testsuites>
5-
<testsuite name="Project Test Suite">
6-
<directory>tests</directory>
7-
</testsuite>
8-
</testsuites>
9-
10-
<filter>
11-
<whitelist>
12-
<directory suffix=".php">src</directory>
13-
</whitelist>
14-
</filter>
1+
<?xml version="1.0"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3+
<coverage>
4+
<include>
5+
<directory suffix=".php">src</directory>
6+
</include>
7+
</coverage>
8+
<testsuites>
9+
<testsuite name="Project Test Suite">
10+
<directory>tests</directory>
11+
</testsuite>
12+
</testsuites>
1513
</phpunit>

tests/CSSList/DocumentTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class DocumentTest extends TestCase
1717
*/
1818
private $subject;
1919

20-
protected function setUp()
20+
protected function setUp(): void
2121
{
2222
$this->subject = new Document();
2323
}

tests/OutputFormatTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class OutputFormatTest extends TestCase
4242
*/
4343
private $oDocument;
4444

45-
protected function setUp()
45+
protected function setUp(): void
4646
{
4747
$this->oParser = new Parser(self::TEST_CSS);
4848
$this->oDocument = $this->oParser->parse();
@@ -268,12 +268,13 @@ public function spaceBeforeBraces()
268268
}
269269

270270
/**
271-
* @expectedException \Sabberworm\CSS\Parsing\OutputException
271+
*
272272
*
273273
* @test
274274
*/
275275
public function ignoreExceptionsOff()
276276
{
277+
$this->expectException(\Sabberworm\CSS\Parsing\OutputException::class);
277278
$aBlocks = $this->oDocument->getAllDeclarationBlocks();
278279
$oFirstBlock = $aBlocks[0];
279280
$oFirstBlock->removeSelector('.main');

tests/ParserTest.php

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -600,12 +600,13 @@ public function listValueRemoval()
600600
}
601601

602602
/**
603-
* @expectedException \Sabberworm\CSS\Parsing\OutputException
603+
*
604604
*
605605
* @test
606606
*/
607607
public function selectorRemoval()
608608
{
609+
$this->expectException(\Sabberworm\CSS\Parsing\OutputException::class);
609610
$oDoc = $this->parsedStructureForFile('1readme');
610611
$aBlocks = $oDoc->getAllDeclarationBlocks();
611612
$oBlock1 = $aBlocks[0];
@@ -802,22 +803,24 @@ public function keyframeSelectors()
802803
}
803804

804805
/**
805-
* @expectedException \Sabberworm\CSS\Parsing\UnexpectedTokenException
806+
*
806807
*
807808
* @test
808809
*/
809810
public function lineNameFailure()
810811
{
812+
$this->expectException(\Sabberworm\CSS\Parsing\UnexpectedTokenException::class);
811813
$this->parsedStructureForFile('-empty-grid-linename', Settings::create()->withLenientParsing(false));
812814
}
813815

814816
/**
815-
* @expectedException \Sabberworm\CSS\Parsing\UnexpectedTokenException
817+
*
816818
*
817819
* @test
818820
*/
819821
public function calcFailure()
820822
{
823+
$this->expectException(\Sabberworm\CSS\Parsing\UnexpectedTokenException::class);
821824
$this->parsedStructureForFile('-calc-no-space-around-minus', Settings::create()->withLenientParsing(false));
822825
}
823826

@@ -884,45 +887,49 @@ public function trailingWhitespace()
884887
}
885888

886889
/**
887-
* @expectedException \Sabberworm\CSS\Parsing\UnexpectedTokenException
890+
*
888891
*
889892
* @test
890893
*/
891894
public function charsetFailure1()
892895
{
896+
$this->expectException(\Sabberworm\CSS\Parsing\UnexpectedTokenException::class);
893897
$this->parsedStructureForFile('-charset-after-rule', Settings::create()->withLenientParsing(false));
894898
}
895899

896900
/**
897-
* @expectedException \Sabberworm\CSS\Parsing\UnexpectedTokenException
901+
*
898902
*
899903
* @test
900904
*/
901905
public function charsetFailure2()
902906
{
907+
$this->expectException(\Sabberworm\CSS\Parsing\UnexpectedTokenException::class);
903908
$this->parsedStructureForFile('-charset-in-block', Settings::create()->withLenientParsing(false));
904909
}
905910

906911
/**
907-
* @expectedException \Sabberworm\CSS\Parsing\SourceException
912+
*
908913
*
909914
* @test
910915
*/
911916
public function unopenedClosingBracketFailure()
912917
{
918+
$this->expectException(\Sabberworm\CSS\Parsing\SourceException::class);
913919
$this->parsedStructureForFile('-unopened-close-brackets', Settings::create()->withLenientParsing(false));
914920
}
915921

916922
/**
917923
* Ensure that a missing property value raises an exception.
918924
*
919-
* @expectedException \Sabberworm\CSS\Parsing\UnexpectedTokenException
925+
*
920926
* @covers \Sabberworm\CSS\Value\Value::parseValue()
921927
*
922928
* @test
923929
*/
924930
public function missingPropertyValueStrict()
925931
{
932+
$this->expectException(\Sabberworm\CSS\Parsing\UnexpectedTokenException::class);
926933
$this->parsedStructureForFile('missing-property-value', Settings::create()->withLenientParsing(false));
927934
}
928935

@@ -1022,12 +1029,13 @@ public function lineNumbersParsing()
10221029
}
10231030

10241031
/**
1025-
* @expectedException \Sabberworm\CSS\Parsing\UnexpectedTokenException
1032+
*
10261033
*
10271034
* @test
10281035
*/
10291036
public function unexpectedTokenExceptionLineNo()
10301037
{
1038+
$this->expectException(\Sabberworm\CSS\Parsing\UnexpectedTokenException::class);
10311039
$oParser = new Parser("\ntest: 1;", Settings::create()->beStrict());
10321040
try {
10331041
$oParser->parse();
@@ -1038,12 +1046,13 @@ public function unexpectedTokenExceptionLineNo()
10381046
}
10391047

10401048
/**
1041-
* @expectedException \Sabberworm\CSS\Parsing\UnexpectedTokenException
1049+
*
10421050
*
10431051
* @test
10441052
*/
10451053
public function ieHacksStrictParsing()
10461054
{
1055+
$this->expectException(\Sabberworm\CSS\Parsing\UnexpectedTokenException::class);
10471056
// We can't strictly parse IE hacks.
10481057
$this->parsedStructureForFile('ie-hacks', Settings::create()->beStrict());
10491058
}
@@ -1147,12 +1156,13 @@ public function topLevelCommentExtracting()
11471156
}
11481157

11491158
/**
1150-
* @expectedException \Sabberworm\CSS\Parsing\UnexpectedTokenException
1159+
*
11511160
*
11521161
* @test
11531162
*/
11541163
public function microsoftFilterStrictParsing()
11551164
{
1165+
$this->expectException(\Sabberworm\CSS\Parsing\UnexpectedTokenException::class);
11561166
$oDoc = $this->parsedStructureForFile('ms-filter', Settings::create()->beStrict());
11571167
}
11581168

tests/RuleSet/LenientParsingTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@
2121
class LenientParsingTest extends TestCase
2222
{
2323
/**
24-
* @expectedException \Sabberworm\CSS\Parsing\UnexpectedTokenException
24+
*
2525
*
2626
* @test
2727
*/
2828
public function faultToleranceOff()
2929
{
30+
$this->expectException(\Sabberworm\CSS\Parsing\UnexpectedTokenException::class);
3031
$sFile = __DIR__ . '/../fixtures/-fault-tolerance.css';
3132
$oParser = new Parser(file_get_contents($sFile), Settings::create()->beStrict());
3233
$oParser->parse();
@@ -48,24 +49,26 @@ public function faultToleranceOn()
4849
}
4950

5051
/**
51-
* @expectedException \Sabberworm\CSS\Parsing\UnexpectedTokenException
52+
*
5253
*
5354
* @test
5455
*/
5556
public function endToken()
5657
{
58+
$this->expectException(\Sabberworm\CSS\Parsing\UnexpectedTokenException::class);
5759
$sFile = __DIR__ . '/../fixtures/-end-token.css';
5860
$oParser = new Parser(file_get_contents($sFile), Settings::create()->beStrict());
5961
$oParser->parse();
6062
}
6163

6264
/**
63-
* @expectedException \Sabberworm\CSS\Parsing\UnexpectedTokenException
65+
*
6466
*
6567
* @test
6668
*/
6769
public function endToken2()
6870
{
71+
$this->expectException(\Sabberworm\CSS\Parsing\UnexpectedTokenException::class);
6972
$sFile = __DIR__ . '/../fixtures/-end-token-2.css';
7073
$oParser = new Parser(file_get_contents($sFile), Settings::create()->beStrict());
7174
$oParser->parse();

0 commit comments

Comments
 (0)