1212namespace Symfony \Component \CssSelector \Tests \XPath ;
1313
1414use PHPUnit \Framework \TestCase ;
15+ use Symfony \Bridge \PhpUnit \ForwardCompatTestTrait ;
1516use Symfony \Component \CssSelector \Node \ElementNode ;
1617use Symfony \Component \CssSelector \Node \FunctionNode ;
1718use Symfony \Component \CssSelector \Parser \Parser ;
2122
2223class TranslatorTest extends TestCase
2324{
25+ use ForwardCompatTestTrait;
26+
2427 /** @dataProvider getXpathLiteralTestData */
2528 public function testXpathLiteral ($ value , $ literal )
2629 {
@@ -35,31 +38,25 @@ public function testCssToXPath($css, $xpath)
3538 $ this ->assertEquals ($ xpath , $ translator ->cssToXPath ($ css , '' ));
3639 }
3740
38- /**
39- * @expectedException \Symfony\Component\CssSelector\Exception\ExpressionErrorException
40- */
4141 public function testCssToXPathPseudoElement ()
4242 {
43+ $ this ->expectException ('Symfony\Component\CssSelector\Exception\ExpressionErrorException ' );
4344 $ translator = new Translator ();
4445 $ translator ->registerExtension (new HtmlExtension ($ translator ));
4546 $ translator ->cssToXPath ('e::first-line ' );
4647 }
4748
48- /**
49- * @expectedException \Symfony\Component\CssSelector\Exception\ExpressionErrorException
50- */
5149 public function testGetExtensionNotExistsExtension ()
5250 {
51+ $ this ->expectException ('Symfony\Component\CssSelector\Exception\ExpressionErrorException ' );
5352 $ translator = new Translator ();
5453 $ translator ->registerExtension (new HtmlExtension ($ translator ));
5554 $ translator ->getExtension ('fake ' );
5655 }
5756
58- /**
59- * @expectedException \Symfony\Component\CssSelector\Exception\ExpressionErrorException
60- */
6157 public function testAddCombinationNotExistsExtension ()
6258 {
59+ $ this ->expectException ('Symfony\Component\CssSelector\Exception\ExpressionErrorException ' );
6360 $ translator = new Translator ();
6461 $ translator ->registerExtension (new HtmlExtension ($ translator ));
6562 $ parser = new Parser ();
@@ -68,34 +65,28 @@ public function testAddCombinationNotExistsExtension()
6865 $ translator ->addCombination ('fake ' , $ xpath , $ combinedXpath );
6966 }
7067
71- /**
72- * @expectedException \Symfony\Component\CssSelector\Exception\ExpressionErrorException
73- */
7468 public function testAddFunctionNotExistsFunction ()
7569 {
70+ $ this ->expectException ('Symfony\Component\CssSelector\Exception\ExpressionErrorException ' );
7671 $ translator = new Translator ();
7772 $ translator ->registerExtension (new HtmlExtension ($ translator ));
7873 $ xpath = new XPathExpr ();
7974 $ function = new FunctionNode (new ElementNode (), 'fake ' );
8075 $ translator ->addFunction ($ xpath , $ function );
8176 }
8277
83- /**
84- * @expectedException \Symfony\Component\CssSelector\Exception\ExpressionErrorException
85- */
8678 public function testAddPseudoClassNotExistsClass ()
8779 {
80+ $ this ->expectException ('Symfony\Component\CssSelector\Exception\ExpressionErrorException ' );
8881 $ translator = new Translator ();
8982 $ translator ->registerExtension (new HtmlExtension ($ translator ));
9083 $ xpath = new XPathExpr ();
9184 $ translator ->addPseudoClass ($ xpath , 'fake ' );
9285 }
9386
94- /**
95- * @expectedException \Symfony\Component\CssSelector\Exception\ExpressionErrorException
96- */
9787 public function testAddAttributeMatchingClassNotExistsClass ()
9888 {
89+ $ this ->expectException ('Symfony\Component\CssSelector\Exception\ExpressionErrorException ' );
9990 $ translator = new Translator ();
10091 $ translator ->registerExtension (new HtmlExtension ($ translator ));
10192 $ xpath = new XPathExpr ();
0 commit comments