Skip to content

Commit ea5e221

Browse files
authored
Merge pull request #252 from oliverklee/cleanup/test-namespace
Move the tests to a separate PHP namespace
2 parents 44ee06a + af5c055 commit ea5e221

File tree

7 files changed

+25
-16
lines changed

7 files changed

+25
-16
lines changed

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
"autoload": {
1919
"psr-4": { "Sabberworm\\CSS\\": "src/" }
2020
},
21+
"autoload-dev": {
22+
"psr-4": { "Sabberworm\\CSS\\Tests\\": "tests/" }
23+
},
2124
"scripts": {
2225
"ci": [
2326
"@ci:static"

tests/CSSList/AtRuleBlockListTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Sabberworm\CSS\CSSList;
3+
namespace Sabberworm\CSS\Tests\CSSList;
44

55
use Sabberworm\CSS\Parser;
66

tests/CSSList/DocumentTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Sabberworm\CSS\CSSList;
3+
namespace Sabberworm\CSS\Tests\CSSList;
44

55
use Sabberworm\CSS\Parser;
66

tests/OutputFormatTest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<?php
22

3-
namespace Sabberworm\CSS;
3+
namespace Sabberworm\CSS\Tests;
4+
5+
use Sabberworm\CSS\OutputFormat;
6+
use Sabberworm\CSS\Parser;
47

58
class OutputFormatTest extends \PHPUnit\Framework\TestCase
69
{
@@ -206,7 +209,7 @@ public function testSpaceBeforeBraces()
206209
}
207210

208211
/**
209-
* @expectedException Sabberworm\CSS\Parsing\OutputException
212+
* @expectedException \Sabberworm\CSS\Parsing\OutputException
210213
*/
211214
public function testIgnoreExceptionsOff()
212215
{

tests/ParserTest.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<?php
22

3-
namespace Sabberworm\CSS;
3+
namespace Sabberworm\CSS\Tests;
44

5+
use Sabberworm\CSS\CSSList\Document;
56
use Sabberworm\CSS\CSSList\KeyFrame;
7+
use Sabberworm\CSS\Parser;
68
use Sabberworm\CSS\Parsing\UnexpectedTokenException;
79
use Sabberworm\CSS\Property\AtRule;
810
use Sabberworm\CSS\Property\Charset;
@@ -11,6 +13,7 @@
1113
use Sabberworm\CSS\Property\Selector;
1214
use Sabberworm\CSS\RuleSet\AtRuleSet;
1315
use Sabberworm\CSS\RuleSet\DeclarationBlock;
16+
use Sabberworm\CSS\Settings;
1417
use Sabberworm\CSS\Value\Size;
1518
use Sabberworm\CSS\Value\URL;
1619

@@ -522,7 +525,7 @@ public function testListValueRemoval()
522525
}
523526

524527
/**
525-
* @expectedException Sabberworm\CSS\Parsing\OutputException
528+
* @expectedException \Sabberworm\CSS\Parsing\OutputException
526529
*/
527530
public function testSelectorRemoval()
528531
{
@@ -680,15 +683,15 @@ public function testKeyframeSelectors()
680683
}
681684

682685
/**
683-
* @expectedException Sabberworm\CSS\Parsing\UnexpectedTokenException
686+
* @expectedException \Sabberworm\CSS\Parsing\UnexpectedTokenException
684687
*/
685688
public function testLineNameFailure()
686689
{
687690
$this->parsedStructureForFile('-empty-grid-linename', Settings::create()->withLenientParsing(false));
688691
}
689692

690693
/**
691-
* @expectedException Sabberworm\CSS\Parsing\UnexpectedTokenException
694+
* @expectedException \Sabberworm\CSS\Parsing\UnexpectedTokenException
692695
*/
693696
public function testCalcFailure()
694697
{
@@ -800,7 +803,7 @@ public function testMissingPropertyValueLenient()
800803
* @param string $sFileName Filename.
801804
* @param null|obJeCt $oSettings Settings.
802805
*
803-
* @return CSSList\Document Parsed document.
806+
* @return Document Parsed document.
804807
*/
805808
private function parsedStructureForFile($sFileName, $oSettings = null)
806809
{
@@ -881,7 +884,7 @@ public function testUnexpectedTokenExceptionLineNo()
881884
}
882885

883886
/**
884-
* @expectedException Sabberworm\CSS\Parsing\UnexpectedTokenException
887+
* @expectedException \Sabberworm\CSS\Parsing\UnexpectedTokenException
885888
*/
886889
public function testIeHacksStrictParsing()
887890
{
@@ -964,7 +967,7 @@ public function testTopLevelCommentExtracting()
964967
}
965968

966969
/**
967-
* @expectedException Sabberworm\CSS\Parsing\UnexpectedTokenException
970+
* @expectedException \Sabberworm\CSS\Parsing\UnexpectedTokenException
968971
*/
969972
public function testMicrosoftFilterStrictParsing()
970973
{

tests/RuleSet/DeclarationBlockTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Sabberworm\CSS\RuleSet;
3+
namespace Sabberworm\CSS\Tests\RuleSet;
44

55
use Sabberworm\CSS\Parser;
66
use Sabberworm\CSS\Rule\Rule;

tests/RuleSet/LenientParsingTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Sabberworm\CSS\RuleSet;
3+
namespace Sabberworm\CSS\Tests\RuleSet;
44

55
use Sabberworm\CSS\Parser;
66
use Sabberworm\CSS\Settings;
@@ -9,7 +9,7 @@ class LenientParsingTest extends \PHPUnit\Framework\TestCase
99
{
1010

1111
/**
12-
* @expectedException Sabberworm\CSS\Parsing\UnexpectedTokenException
12+
* @expectedException \Sabberworm\CSS\Parsing\UnexpectedTokenException
1313
*/
1414
public function testFaultToleranceOff()
1515
{
@@ -31,7 +31,7 @@ public function testFaultToleranceOn()
3131
}
3232

3333
/**
34-
* @expectedException Sabberworm\CSS\Parsing\UnexpectedTokenException
34+
* @expectedException \Sabberworm\CSS\Parsing\UnexpectedTokenException
3535
*/
3636
public function testEndToken()
3737
{
@@ -41,7 +41,7 @@ public function testEndToken()
4141
}
4242

4343
/**
44-
* @expectedException Sabberworm\CSS\Parsing\UnexpectedTokenException
44+
* @expectedException \Sabberworm\CSS\Parsing\UnexpectedTokenException
4545
*/
4646
public function testEndToken2()
4747
{

0 commit comments

Comments
 (0)