Skip to content

Commit ef9d317

Browse files
committed
Fix deprecated phpunit annotation
1 parent 16901fe commit ef9d317

File tree

2 files changed

+14
-22
lines changed

2 files changed

+14
-22
lines changed

Tests/CssSelectorConverterTest.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@
1212
namespace Symfony\Component\CssSelector\Tests;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
1516
use Symfony\Component\CssSelector\CssSelectorConverter;
1617

1718
class CssSelectorConverterTest extends TestCase
1819
{
20+
use ForwardCompatTestTrait;
21+
1922
public function testCssToXPath()
2023
{
2124
$converter = new CssSelectorConverter();
@@ -35,12 +38,10 @@ public function testCssToXPathXml()
3538
$this->assertEquals('descendant-or-self::H1', $converter->toXPath('H1'));
3639
}
3740

38-
/**
39-
* @expectedException \Symfony\Component\CssSelector\Exception\ParseException
40-
* @expectedExceptionMessage Expected identifier, but <eof at 3> found.
41-
*/
4241
public function testParseExceptions()
4342
{
43+
$this->expectException('Symfony\Component\CssSelector\Exception\ParseException');
44+
$this->expectExceptionMessage('Expected identifier, but <eof at 3> found.');
4445
$converter = new CssSelectorConverter();
4546
$converter->toXPath('h1:');
4647
}

Tests/XPath/TranslatorTest.php

+9-18
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\CssSelector\Tests\XPath;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
1516
use Symfony\Component\CssSelector\Node\ElementNode;
1617
use Symfony\Component\CssSelector\Node\FunctionNode;
1718
use Symfony\Component\CssSelector\Parser\Parser;
@@ -21,6 +22,8 @@
2122

2223
class 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

Comments
 (0)