Skip to content

Commit 16901fe

Browse files
committed
Replace calls to setExpectedException by Pollyfill
1 parent 8ca2929 commit 16901fe

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

Tests/Parser/ParserTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\CssSelector\Tests\Parser;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
1516
use Symfony\Component\CssSelector\Exception\SyntaxErrorException;
1617
use Symfony\Component\CssSelector\Node\FunctionNode;
1718
use Symfony\Component\CssSelector\Node\SelectorNode;
@@ -20,6 +21,8 @@
2021

2122
class ParserTest extends TestCase
2223
{
24+
use ForwardCompatTestTrait;
25+
2326
/** @dataProvider getParserTestData */
2427
public function testParser($source, $representation)
2528
{
@@ -89,7 +92,7 @@ public function testParseSeriesException($series)
8992

9093
/** @var FunctionNode $function */
9194
$function = $selectors[0]->getTree();
92-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
95+
$this->expectException('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
9396
Parser::parseSeries($function->getArguments());
9497
}
9598

Tests/Parser/TokenStreamTest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@
1212
namespace Symfony\Component\CssSelector\Tests\Parser;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
1516
use Symfony\Component\CssSelector\Parser\Token;
1617
use Symfony\Component\CssSelector\Parser\TokenStream;
1718

1819
class TokenStreamTest extends TestCase
1920
{
21+
use ForwardCompatTestTrait;
22+
2023
public function testGetNext()
2124
{
2225
$stream = new TokenStream();
@@ -53,7 +56,7 @@ public function testGetNextIdentifier()
5356

5457
public function testFailToGetNextIdentifier()
5558
{
56-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
59+
$this->expectException('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
5760

5861
$stream = new TokenStream();
5962
$stream->push(new Token(Token::TYPE_DELIMITER, '.', 2));
@@ -73,7 +76,7 @@ public function testGetNextIdentifierOrStar()
7376

7477
public function testFailToGetNextIdentifierOrStar()
7578
{
76-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
79+
$this->expectException('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
7780

7881
$stream = new TokenStream();
7982
$stream->push(new Token(Token::TYPE_DELIMITER, '.', 2));

0 commit comments

Comments
 (0)