From 189da2252866407b798b6a0ca9a2d63d55b52946 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 14 Jan 2019 10:04:16 +0100 Subject: [PATCH] fix compatibility with PHPUnit 4.8 --- .../Tests/XPath/TranslatorTest.php | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/Symfony/Component/CssSelector/Tests/XPath/TranslatorTest.php b/src/Symfony/Component/CssSelector/Tests/XPath/TranslatorTest.php index ae961d48c7..92957df5f1 100644 --- a/src/Symfony/Component/CssSelector/Tests/XPath/TranslatorTest.php +++ b/src/Symfony/Component/CssSelector/Tests/XPath/TranslatorTest.php @@ -12,7 +12,6 @@ namespace Symfony\Component\CssSelector\Tests\XPath; use PHPUnit\Framework\TestCase; -use Symfony\Component\CssSelector\Exception\ExpressionErrorException; use Symfony\Component\CssSelector\Node\ElementNode; use Symfony\Component\CssSelector\Node\FunctionNode; use Symfony\Component\CssSelector\Parser\Parser; @@ -36,58 +35,70 @@ class TranslatorTest extends TestCase $this->assertEquals($xpath, $translator->cssToXPath($css, '')); } + /** + * @expectedException \Symfony\Component\CssSelector\Exception\ExpressionErrorException + */ public function testCssToXPathPseudoElement() { $translator = new Translator(); $translator->registerExtension(new HtmlExtension($translator)); - $this->expectException(ExpressionErrorException::class); $translator->cssToXPath('e::first-line'); } + /** + * @expectedException \Symfony\Component\CssSelector\Exception\ExpressionErrorException + */ public function testGetExtensionNotExistsExtension() { $translator = new Translator(); $translator->registerExtension(new HtmlExtension($translator)); - $this->expectException(ExpressionErrorException::class); $translator->getExtension('fake'); } + /** + * @expectedException \Symfony\Component\CssSelector\Exception\ExpressionErrorException + */ public function testAddCombinationNotExistsExtension() { $translator = new Translator(); $translator->registerExtension(new HtmlExtension($translator)); - $this->expectException(ExpressionErrorException::class); $parser = new Parser(); $xpath = $parser->parse('*')[0]; $combinedXpath = $parser->parse('*')[0]; $translator->addCombination('fake', $xpath, $combinedXpath); } + /** + * @expectedException \Symfony\Component\CssSelector\Exception\ExpressionErrorException + */ public function testAddFunctionNotExistsFunction() { $translator = new Translator(); $translator->registerExtension(new HtmlExtension($translator)); $xpath = new XPathExpr(); $function = new FunctionNode(new ElementNode(), 'fake'); - $this->expectException(ExpressionErrorException::class); $translator->addFunction($xpath, $function); } + /** + * @expectedException \Symfony\Component\CssSelector\Exception\ExpressionErrorException + */ public function testAddPseudoClassNotExistsClass() { $translator = new Translator(); $translator->registerExtension(new HtmlExtension($translator)); $xpath = new XPathExpr(); - $this->expectException(ExpressionErrorException::class); $translator->addPseudoClass($xpath, 'fake'); } + /** + * @expectedException \Symfony\Component\CssSelector\Exception\ExpressionErrorException + */ public function testAddAttributeMatchingClassNotExistsClass() { $translator = new Translator(); $translator->registerExtension(new HtmlExtension($translator)); $xpath = new XPathExpr(); - $this->expectException(ExpressionErrorException::class); $translator->addAttributeMatching($xpath, '', '', ''); }