1212namespace Symfony \Component \CssSelector \Tests \XPath ;
1313
1414use PHPUnit \Framework \TestCase ;
15- use Symfony \Component \CssSelector \Exception \ExpressionErrorException ;
1615use Symfony \Component \CssSelector \Node \ElementNode ;
1716use Symfony \Component \CssSelector \Node \FunctionNode ;
1817use Symfony \Component \CssSelector \Parser \Parser ;
@@ -36,58 +35,70 @@ public function testCssToXPath($css, $xpath)
3635 $ this ->assertEquals ($ xpath , $ translator ->cssToXPath ($ css , '' ));
3736 }
3837
38+ /**
39+ * @expectedException \Symfony\Component\CssSelector\Exception\ExpressionErrorException
40+ */
3941 public function testCssToXPathPseudoElement ()
4042 {
4143 $ translator = new Translator ();
4244 $ translator ->registerExtension (new HtmlExtension ($ translator ));
43- $ this ->expectException (ExpressionErrorException::class);
4445 $ translator ->cssToXPath ('e::first-line ' );
4546 }
4647
48+ /**
49+ * @expectedException \Symfony\Component\CssSelector\Exception\ExpressionErrorException
50+ */
4751 public function testGetExtensionNotExistsExtension ()
4852 {
4953 $ translator = new Translator ();
5054 $ translator ->registerExtension (new HtmlExtension ($ translator ));
51- $ this ->expectException (ExpressionErrorException::class);
5255 $ translator ->getExtension ('fake ' );
5356 }
5457
58+ /**
59+ * @expectedException \Symfony\Component\CssSelector\Exception\ExpressionErrorException
60+ */
5561 public function testAddCombinationNotExistsExtension ()
5662 {
5763 $ translator = new Translator ();
5864 $ translator ->registerExtension (new HtmlExtension ($ translator ));
59- $ this ->expectException (ExpressionErrorException::class);
6065 $ parser = new Parser ();
6166 $ xpath = $ parser ->parse ('* ' )[0 ];
6267 $ combinedXpath = $ parser ->parse ('* ' )[0 ];
6368 $ translator ->addCombination ('fake ' , $ xpath , $ combinedXpath );
6469 }
6570
71+ /**
72+ * @expectedException \Symfony\Component\CssSelector\Exception\ExpressionErrorException
73+ */
6674 public function testAddFunctionNotExistsFunction ()
6775 {
6876 $ translator = new Translator ();
6977 $ translator ->registerExtension (new HtmlExtension ($ translator ));
7078 $ xpath = new XPathExpr ();
7179 $ function = new FunctionNode (new ElementNode (), 'fake ' );
72- $ this ->expectException (ExpressionErrorException::class);
7380 $ translator ->addFunction ($ xpath , $ function );
7481 }
7582
83+ /**
84+ * @expectedException \Symfony\Component\CssSelector\Exception\ExpressionErrorException
85+ */
7686 public function testAddPseudoClassNotExistsClass ()
7787 {
7888 $ translator = new Translator ();
7989 $ translator ->registerExtension (new HtmlExtension ($ translator ));
8090 $ xpath = new XPathExpr ();
81- $ this ->expectException (ExpressionErrorException::class);
8291 $ translator ->addPseudoClass ($ xpath , 'fake ' );
8392 }
8493
94+ /**
95+ * @expectedException \Symfony\Component\CssSelector\Exception\ExpressionErrorException
96+ */
8597 public function testAddAttributeMatchingClassNotExistsClass ()
8698 {
8799 $ translator = new Translator ();
88100 $ translator ->registerExtension (new HtmlExtension ($ translator ));
89101 $ xpath = new XPathExpr ();
90- $ this ->expectException (ExpressionErrorException::class);
91102 $ translator ->addAttributeMatching ($ xpath , '' , '' , '' );
92103 }
93104
0 commit comments