@@ -29,7 +29,30 @@ public function testFaultToleranceOn() {
29
29
public function testEndToken () {
30
30
$ sFile = dirname (__FILE__ ) . '/../../../files ' . DIRECTORY_SEPARATOR . "-end-token.css " ;
31
31
$ oParser = new Parser (file_get_contents ($ sFile ), Settings::create ()->beStrict ());
32
+ $ oParser ->parse ();
33
+ }
34
+
35
+ /**
36
+ * @expectedException Sabberworm\CSS\Parsing\UnexpectedTokenException
37
+ */
38
+ public function testEndToken2 () {
39
+ $ sFile = dirname (__FILE__ ) . '/../../../files ' . DIRECTORY_SEPARATOR . "-end-token-2.css " ;
40
+ $ oParser = new Parser (file_get_contents ($ sFile ), Settings::create ()->beStrict ());
41
+ $ oParser ->parse ();
42
+ }
43
+
44
+ public function testEndTokenPositive () {
45
+ $ sFile = dirname (__FILE__ ) . '/../../../files ' . DIRECTORY_SEPARATOR . "-end-token.css " ;
46
+ $ oParser = new Parser (file_get_contents ($ sFile ), Settings::create ()->withLenientParsing (true ));
47
+ $ oResult = $ oParser ->parse ();
48
+ $ this ->assertSame ("" , $ oResult ->__toString ());
49
+ }
50
+
51
+ public function testEndToken2Positive () {
52
+ $ sFile = dirname (__FILE__ ) . '/../../../files ' . DIRECTORY_SEPARATOR . "-end-token-2.css " ;
53
+ $ oParser = new Parser (file_get_contents ($ sFile ), Settings::create ()->withLenientParsing (true ));
32
54
$ oResult = $ oParser ->parse ();
55
+ $ this ->assertSame ('#home .bg-layout {background-image: url("/bundles/main/img/bg1.png?5");} ' ."\n" , $ oResult ->__toString ());
33
56
}
34
57
35
58
public function testLocaleTrap () {
@@ -44,7 +67,7 @@ public function testCaseInsensitivity() {
44
67
$ sFile = dirname (__FILE__ ) . '/../../../files ' . DIRECTORY_SEPARATOR . "case-insensitivity.css " ;
45
68
$ oParser = new Parser (file_get_contents ($ sFile ));
46
69
$ oResult = $ oParser ->parse ();
47
- $ this ->assertSame ('@charset "utf-8";@import url("test.css");@media screen {}#myid {case: insensitive !important;frequency: 30Hz;color: #ff0;color: hsl(40,40%,30%);font-family: Arial;} ' ."\n" , $ oResult ->__toString ());
70
+ $ this ->assertSame ('@charset "utf-8";@import url("test.css");@media screen {}#myid {case: insensitive !important;frequency: 30Hz;font-size: 1em; color: #ff0;color: hsl(40,40%,30%);font-family: Arial;} ' ."\n" , $ oResult ->__toString ());
48
71
}
49
72
50
73
}
0 commit comments