@@ -38,56 +38,68 @@ public function testCssToXPath($css, $xpath)
38
38
39
39
public function testCssToXPathPseudoElement ()
40
40
{
41
- $ this ->expectException (ExpressionErrorException::class);
42
41
$ translator = new Translator ();
43
42
$ translator ->registerExtension (new HtmlExtension ($ translator ));
43
+
44
+ $ this ->expectException (ExpressionErrorException::class);
45
+
44
46
$ translator ->cssToXPath ('e::first-line ' );
45
47
}
46
48
47
49
public function testGetExtensionNotExistsExtension ()
48
50
{
49
- $ this ->expectException (ExpressionErrorException::class);
50
51
$ translator = new Translator ();
51
52
$ translator ->registerExtension (new HtmlExtension ($ translator ));
53
+
54
+ $ this ->expectException (ExpressionErrorException::class);
55
+
52
56
$ translator ->getExtension ('fake ' );
53
57
}
54
58
55
59
public function testAddCombinationNotExistsExtension ()
56
60
{
57
- $ this ->expectException (ExpressionErrorException::class);
58
61
$ translator = new Translator ();
59
62
$ translator ->registerExtension (new HtmlExtension ($ translator ));
60
63
$ parser = new Parser ();
61
64
$ xpath = $ parser ->parse ('* ' )[0 ];
62
65
$ combinedXpath = $ parser ->parse ('* ' )[0 ];
66
+
67
+ $ this ->expectException (ExpressionErrorException::class);
68
+
63
69
$ translator ->addCombination ('fake ' , $ xpath , $ combinedXpath );
64
70
}
65
71
66
72
public function testAddFunctionNotExistsFunction ()
67
73
{
68
- $ this ->expectException (ExpressionErrorException::class);
69
74
$ translator = new Translator ();
70
75
$ translator ->registerExtension (new HtmlExtension ($ translator ));
71
76
$ xpath = new XPathExpr ();
72
77
$ function = new FunctionNode (new ElementNode (), 'fake ' );
78
+
79
+ $ this ->expectException (ExpressionErrorException::class);
80
+
73
81
$ translator ->addFunction ($ xpath , $ function );
74
82
}
75
83
76
84
public function testAddPseudoClassNotExistsClass ()
77
85
{
78
- $ this ->expectException (ExpressionErrorException::class);
79
86
$ translator = new Translator ();
80
87
$ translator ->registerExtension (new HtmlExtension ($ translator ));
81
88
$ xpath = new XPathExpr ();
89
+
90
+ $ this ->expectException (ExpressionErrorException::class);
91
+
82
92
$ translator ->addPseudoClass ($ xpath , 'fake ' );
83
93
}
84
94
85
95
public function testAddAttributeMatchingClassNotExistsClass ()
86
96
{
87
- $ this ->expectException (ExpressionErrorException::class);
88
97
$ translator = new Translator ();
89
98
$ translator ->registerExtension (new HtmlExtension ($ translator ));
90
99
$ xpath = new XPathExpr ();
100
+
101
+ $ this ->expectException (ExpressionErrorException::class);
102
+
91
103
$ translator ->addAttributeMatching ($ xpath , '' , '' , '' );
92
104
}
93
105
0 commit comments