Skip to content

Commit f907d3e

Browse files
OskarStarknicolas-grekas
authored andcommitted
Use createMock() and use import instead of FQCN
1 parent 4b56d1a commit f907d3e

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

Tests/CssSelectorConverterTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\CssSelector\CssSelectorConverter;
16+
use Symfony\Component\CssSelector\Exception\ParseException;
1617

1718
class CssSelectorConverterTest extends TestCase
1819
{
@@ -37,7 +38,7 @@ public function testCssToXPathXml()
3738

3839
public function testParseExceptions()
3940
{
40-
$this->expectException(\Symfony\Component\CssSelector\Exception\ParseException::class);
41+
$this->expectException(ParseException::class);
4142
$this->expectExceptionMessage('Expected identifier, but <eof at 3> found.');
4243
$converter = new CssSelectorConverter();
4344
$converter->toXPath('h1:');

Tests/Parser/TokenStreamTest.php

Lines changed: 3 additions & 2 deletions
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\Component\CssSelector\Exception\SyntaxErrorException;
1516
use Symfony\Component\CssSelector\Parser\Token;
1617
use Symfony\Component\CssSelector\Parser\TokenStream;
1718

@@ -53,7 +54,7 @@ public function testGetNextIdentifier()
5354

5455
public function testFailToGetNextIdentifier()
5556
{
56-
$this->expectException(\Symfony\Component\CssSelector\Exception\SyntaxErrorException::class);
57+
$this->expectException(SyntaxErrorException::class);
5758

5859
$stream = new TokenStream();
5960
$stream->push(new Token(Token::TYPE_DELIMITER, '.', 2));
@@ -73,7 +74,7 @@ public function testGetNextIdentifierOrStar()
7374

7475
public function testFailToGetNextIdentifierOrStar()
7576
{
76-
$this->expectException(\Symfony\Component\CssSelector\Exception\SyntaxErrorException::class);
77+
$this->expectException(SyntaxErrorException::class);
7778

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

Tests/XPath/TranslatorTest.php

Lines changed: 7 additions & 6 deletions
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\Component\CssSelector\Exception\ExpressionErrorException;
1516
use Symfony\Component\CssSelector\Node\ElementNode;
1617
use Symfony\Component\CssSelector\Node\FunctionNode;
1718
use Symfony\Component\CssSelector\Parser\Parser;
@@ -37,23 +38,23 @@ public function testCssToXPath($css, $xpath)
3738

3839
public function testCssToXPathPseudoElement()
3940
{
40-
$this->expectException(\Symfony\Component\CssSelector\Exception\ExpressionErrorException::class);
41+
$this->expectException(ExpressionErrorException::class);
4142
$translator = new Translator();
4243
$translator->registerExtension(new HtmlExtension($translator));
4344
$translator->cssToXPath('e::first-line');
4445
}
4546

4647
public function testGetExtensionNotExistsExtension()
4748
{
48-
$this->expectException(\Symfony\Component\CssSelector\Exception\ExpressionErrorException::class);
49+
$this->expectException(ExpressionErrorException::class);
4950
$translator = new Translator();
5051
$translator->registerExtension(new HtmlExtension($translator));
5152
$translator->getExtension('fake');
5253
}
5354

5455
public function testAddCombinationNotExistsExtension()
5556
{
56-
$this->expectException(\Symfony\Component\CssSelector\Exception\ExpressionErrorException::class);
57+
$this->expectException(ExpressionErrorException::class);
5758
$translator = new Translator();
5859
$translator->registerExtension(new HtmlExtension($translator));
5960
$parser = new Parser();
@@ -64,7 +65,7 @@ public function testAddCombinationNotExistsExtension()
6465

6566
public function testAddFunctionNotExistsFunction()
6667
{
67-
$this->expectException(\Symfony\Component\CssSelector\Exception\ExpressionErrorException::class);
68+
$this->expectException(ExpressionErrorException::class);
6869
$translator = new Translator();
6970
$translator->registerExtension(new HtmlExtension($translator));
7071
$xpath = new XPathExpr();
@@ -74,7 +75,7 @@ public function testAddFunctionNotExistsFunction()
7475

7576
public function testAddPseudoClassNotExistsClass()
7677
{
77-
$this->expectException(\Symfony\Component\CssSelector\Exception\ExpressionErrorException::class);
78+
$this->expectException(ExpressionErrorException::class);
7879
$translator = new Translator();
7980
$translator->registerExtension(new HtmlExtension($translator));
8081
$xpath = new XPathExpr();
@@ -83,7 +84,7 @@ public function testAddPseudoClassNotExistsClass()
8384

8485
public function testAddAttributeMatchingClassNotExistsClass()
8586
{
86-
$this->expectException(\Symfony\Component\CssSelector\Exception\ExpressionErrorException::class);
87+
$this->expectException(ExpressionErrorException::class);
8788
$translator = new Translator();
8889
$translator->registerExtension(new HtmlExtension($translator));
8990
$xpath = new XPathExpr();

0 commit comments

Comments
 (0)