@@ -38,56 +38,68 @@ public function testCssToXPath($css, $xpath)
3838
3939 public function testCssToXPathPseudoElement ()
4040 {
41- $ this ->expectException (ExpressionErrorException::class);
4241 $ translator = new Translator ();
4342 $ translator ->registerExtension (new HtmlExtension ($ translator ));
43+
44+ $ this ->expectException (ExpressionErrorException::class);
45+
4446 $ translator ->cssToXPath ('e::first-line ' );
4547 }
4648
4749 public function testGetExtensionNotExistsExtension ()
4850 {
49- $ this ->expectException (ExpressionErrorException::class);
5051 $ translator = new Translator ();
5152 $ translator ->registerExtension (new HtmlExtension ($ translator ));
53+
54+ $ this ->expectException (ExpressionErrorException::class);
55+
5256 $ translator ->getExtension ('fake ' );
5357 }
5458
5559 public function testAddCombinationNotExistsExtension ()
5660 {
57- $ this ->expectException (ExpressionErrorException::class);
5861 $ translator = new Translator ();
5962 $ translator ->registerExtension (new HtmlExtension ($ translator ));
6063 $ parser = new Parser ();
6164 $ xpath = $ parser ->parse ('* ' )[0 ];
6265 $ combinedXpath = $ parser ->parse ('* ' )[0 ];
66+
67+ $ this ->expectException (ExpressionErrorException::class);
68+
6369 $ translator ->addCombination ('fake ' , $ xpath , $ combinedXpath );
6470 }
6571
6672 public function testAddFunctionNotExistsFunction ()
6773 {
68- $ this ->expectException (ExpressionErrorException::class);
6974 $ translator = new Translator ();
7075 $ translator ->registerExtension (new HtmlExtension ($ translator ));
7176 $ xpath = new XPathExpr ();
7277 $ function = new FunctionNode (new ElementNode (), 'fake ' );
78+
79+ $ this ->expectException (ExpressionErrorException::class);
80+
7381 $ translator ->addFunction ($ xpath , $ function );
7482 }
7583
7684 public function testAddPseudoClassNotExistsClass ()
7785 {
78- $ this ->expectException (ExpressionErrorException::class);
7986 $ translator = new Translator ();
8087 $ translator ->registerExtension (new HtmlExtension ($ translator ));
8188 $ xpath = new XPathExpr ();
89+
90+ $ this ->expectException (ExpressionErrorException::class);
91+
8292 $ translator ->addPseudoClass ($ xpath , 'fake ' );
8393 }
8494
8595 public function testAddAttributeMatchingClassNotExistsClass ()
8696 {
87- $ this ->expectException (ExpressionErrorException::class);
8897 $ translator = new Translator ();
8998 $ translator ->registerExtension (new HtmlExtension ($ translator ));
9099 $ xpath = new XPathExpr ();
100+
101+ $ this ->expectException (ExpressionErrorException::class);
102+
91103 $ translator ->addAttributeMatching ($ xpath , '' , '' , '' );
92104 }
93105
0 commit comments