12
12
namespace Symfony \Component \CssSelector \Tests \XPath ;
13
13
14
14
use PHPUnit \Framework \TestCase ;
15
+ use Symfony \Bridge \PhpUnit \ForwardCompatTestTrait ;
15
16
use Symfony \Component \CssSelector \Node \ElementNode ;
16
17
use Symfony \Component \CssSelector \Node \FunctionNode ;
17
18
use Symfony \Component \CssSelector \Parser \Parser ;
21
22
22
23
class TranslatorTest extends TestCase
23
24
{
25
+ use ForwardCompatTestTrait;
26
+
24
27
/** @dataProvider getXpathLiteralTestData */
25
28
public function testXpathLiteral ($ value , $ literal )
26
29
{
@@ -35,31 +38,25 @@ public function testCssToXPath($css, $xpath)
35
38
$ this ->assertEquals ($ xpath , $ translator ->cssToXPath ($ css , '' ));
36
39
}
37
40
38
- /**
39
- * @expectedException \Symfony\Component\CssSelector\Exception\ExpressionErrorException
40
- */
41
41
public function testCssToXPathPseudoElement ()
42
42
{
43
+ $ this ->expectException ('Symfony\Component\CssSelector\Exception\ExpressionErrorException ' );
43
44
$ translator = new Translator ();
44
45
$ translator ->registerExtension (new HtmlExtension ($ translator ));
45
46
$ translator ->cssToXPath ('e::first-line ' );
46
47
}
47
48
48
- /**
49
- * @expectedException \Symfony\Component\CssSelector\Exception\ExpressionErrorException
50
- */
51
49
public function testGetExtensionNotExistsExtension ()
52
50
{
51
+ $ this ->expectException ('Symfony\Component\CssSelector\Exception\ExpressionErrorException ' );
53
52
$ translator = new Translator ();
54
53
$ translator ->registerExtension (new HtmlExtension ($ translator ));
55
54
$ translator ->getExtension ('fake ' );
56
55
}
57
56
58
- /**
59
- * @expectedException \Symfony\Component\CssSelector\Exception\ExpressionErrorException
60
- */
61
57
public function testAddCombinationNotExistsExtension ()
62
58
{
59
+ $ this ->expectException ('Symfony\Component\CssSelector\Exception\ExpressionErrorException ' );
63
60
$ translator = new Translator ();
64
61
$ translator ->registerExtension (new HtmlExtension ($ translator ));
65
62
$ parser = new Parser ();
@@ -68,34 +65,28 @@ public function testAddCombinationNotExistsExtension()
68
65
$ translator ->addCombination ('fake ' , $ xpath , $ combinedXpath );
69
66
}
70
67
71
- /**
72
- * @expectedException \Symfony\Component\CssSelector\Exception\ExpressionErrorException
73
- */
74
68
public function testAddFunctionNotExistsFunction ()
75
69
{
70
+ $ this ->expectException ('Symfony\Component\CssSelector\Exception\ExpressionErrorException ' );
76
71
$ translator = new Translator ();
77
72
$ translator ->registerExtension (new HtmlExtension ($ translator ));
78
73
$ xpath = new XPathExpr ();
79
74
$ function = new FunctionNode (new ElementNode (), 'fake ' );
80
75
$ translator ->addFunction ($ xpath , $ function );
81
76
}
82
77
83
- /**
84
- * @expectedException \Symfony\Component\CssSelector\Exception\ExpressionErrorException
85
- */
86
78
public function testAddPseudoClassNotExistsClass ()
87
79
{
80
+ $ this ->expectException ('Symfony\Component\CssSelector\Exception\ExpressionErrorException ' );
88
81
$ translator = new Translator ();
89
82
$ translator ->registerExtension (new HtmlExtension ($ translator ));
90
83
$ xpath = new XPathExpr ();
91
84
$ translator ->addPseudoClass ($ xpath , 'fake ' );
92
85
}
93
86
94
- /**
95
- * @expectedException \Symfony\Component\CssSelector\Exception\ExpressionErrorException
96
- */
97
87
public function testAddAttributeMatchingClassNotExistsClass ()
98
88
{
89
+ $ this ->expectException ('Symfony\Component\CssSelector\Exception\ExpressionErrorException ' );
99
90
$ translator = new Translator ();
100
91
$ translator ->registerExtension (new HtmlExtension ($ translator ));
101
92
$ xpath = new XPathExpr ();
0 commit comments