7
7
use Sabberworm \CSS \CSSList \KeyFrame ;
8
8
use Sabberworm \CSS \OutputFormat ;
9
9
use Sabberworm \CSS \Parser ;
10
+ use Sabberworm \CSS \Parsing \OutputException ;
11
+ use Sabberworm \CSS \Parsing \SourceException ;
10
12
use Sabberworm \CSS \Parsing \UnexpectedTokenException ;
11
13
use Sabberworm \CSS \Property \AtRule ;
12
14
use Sabberworm \CSS \Property \Charset ;
@@ -601,12 +603,12 @@ public function listValueRemoval()
601
603
}
602
604
603
605
/**
604
- * @expectedException \Sabberworm\CSS\Parsing\OutputException
605
- *
606
606
* @test
607
607
*/
608
608
public function selectorRemoval ()
609
609
{
610
+ $ this ->expectException (OutputException::class);
611
+
610
612
$ oDoc = self ::parsedStructureForFile ('1readme ' );
611
613
$ aBlocks = $ oDoc ->getAllDeclarationBlocks ();
612
614
$ oBlock1 = $ aBlocks [0 ];
@@ -805,22 +807,22 @@ public function keyframeSelectors()
805
807
}
806
808
807
809
/**
808
- * @expectedException \Sabberworm\CSS\Parsing\UnexpectedTokenException
809
- *
810
810
* @test
811
811
*/
812
812
public function lineNameFailure ()
813
813
{
814
+ $ this ->expectException (UnexpectedTokenException::class);
815
+
814
816
self ::parsedStructureForFile ('-empty-grid-linename ' , Settings::create ()->withLenientParsing (false ));
815
817
}
816
818
817
819
/**
818
- * @expectedException \Sabberworm\CSS\Parsing\UnexpectedTokenException
819
- *
820
820
* @test
821
821
*/
822
822
public function calcFailure ()
823
823
{
824
+ $ this ->expectException (UnexpectedTokenException::class);
825
+
824
826
self ::parsedStructureForFile ('-calc-no-space-around-minus ' , Settings::create ()->withLenientParsing (false ));
825
827
}
826
828
@@ -887,45 +889,46 @@ public function trailingWhitespace()
887
889
}
888
890
889
891
/**
890
- * @expectedException \Sabberworm\CSS\Parsing\UnexpectedTokenException
891
- *
892
892
* @test
893
893
*/
894
894
public function charsetFailure1 ()
895
895
{
896
+ $ this ->expectException (UnexpectedTokenException::class);
897
+
896
898
self ::parsedStructureForFile ('-charset-after-rule ' , Settings::create ()->withLenientParsing (false ));
897
899
}
898
900
899
901
/**
900
- * @expectedException \Sabberworm\CSS\Parsing\UnexpectedTokenException
901
- *
902
902
* @test
903
903
*/
904
904
public function charsetFailure2 ()
905
905
{
906
+ $ this ->expectException (UnexpectedTokenException::class);
907
+
906
908
self ::parsedStructureForFile ('-charset-in-block ' , Settings::create ()->withLenientParsing (false ));
907
909
}
908
910
909
911
/**
910
- * @expectedException \Sabberworm\CSS\Parsing\SourceException
911
- *
912
912
* @test
913
913
*/
914
914
public function unopenedClosingBracketFailure ()
915
915
{
916
+ $ this ->expectException (SourceException::class);
917
+
916
918
self ::parsedStructureForFile ('-unopened-close-brackets ' , Settings::create ()->withLenientParsing (false ));
917
919
}
918
920
919
921
/**
920
922
* Ensure that a missing property value raises an exception.
921
923
*
922
- * @expectedException \Sabberworm\CSS\Parsing\UnexpectedTokenException
923
924
* @covers \Sabberworm\CSS\Value\Value::parseValue()
924
925
*
925
926
* @test
926
927
*/
927
928
public function missingPropertyValueStrict ()
928
929
{
930
+ $ this ->expectException (UnexpectedTokenException::class);
931
+
929
932
self ::parsedStructureForFile ('missing-property-value ' , Settings::create ()->withLenientParsing (false ));
930
933
}
931
934
@@ -1025,12 +1028,12 @@ public function lineNumbersParsing()
1025
1028
}
1026
1029
1027
1030
/**
1028
- * @expectedException \Sabberworm\CSS\Parsing\UnexpectedTokenException
1029
- *
1030
1031
* @test
1031
1032
*/
1032
1033
public function unexpectedTokenExceptionLineNo ()
1033
1034
{
1035
+ $ this ->expectException (UnexpectedTokenException::class);
1036
+
1034
1037
$ oParser = new Parser ("\ntest: 1; " , Settings::create ()->beStrict ());
1035
1038
try {
1036
1039
$ oParser ->parse ();
@@ -1041,12 +1044,12 @@ public function unexpectedTokenExceptionLineNo()
1041
1044
}
1042
1045
1043
1046
/**
1044
- * @expectedException \Sabberworm\CSS\Parsing\UnexpectedTokenException
1045
- *
1046
1047
* @test
1047
1048
*/
1048
1049
public function ieHacksStrictParsing ()
1049
1050
{
1051
+ $ this ->expectException (UnexpectedTokenException::class);
1052
+
1050
1053
// We can't strictly parse IE hacks.
1051
1054
self ::parsedStructureForFile ('ie-hacks ' , Settings::create ()->beStrict ());
1052
1055
}
@@ -1138,12 +1141,12 @@ public function topLevelCommentExtracting()
1138
1141
}
1139
1142
1140
1143
/**
1141
- * @expectedException \Sabberworm\CSS\Parsing\UnexpectedTokenException
1142
- *
1143
1144
* @test
1144
1145
*/
1145
1146
public function microsoftFilterStrictParsing ()
1146
1147
{
1148
+ $ this ->expectException (UnexpectedTokenException::class);
1149
+
1147
1150
$ oDoc = self ::parsedStructureForFile ('ms-filter ' , Settings::create ()->beStrict ());
1148
1151
}
1149
1152
0 commit comments