From e61859cff86f73a04fc82630b87c62bedb99fea1 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Sun, 5 Feb 2023 10:12:16 +0100 Subject: [PATCH 1/2] [Tests] Migrate data providers to static ones --- Tests/Node/AbstractNodeTest.php | 4 ++-- Tests/Node/AttributeNodeTest.php | 4 ++-- Tests/Node/ClassNodeTest.php | 4 ++-- Tests/Node/CombinedSelectorNodeTest.php | 4 ++-- Tests/Node/ElementNodeTest.php | 4 ++-- Tests/Node/FunctionNodeTest.php | 4 ++-- Tests/Node/HashNodeTest.php | 4 ++-- Tests/Node/NegationNodeTest.php | 4 ++-- Tests/Node/PseudoNodeTest.php | 4 ++-- Tests/Node/SelectorNodeTest.php | 4 ++-- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Tests/Node/AbstractNodeTest.php b/Tests/Node/AbstractNodeTest.php index 5955513..85fe646 100644 --- a/Tests/Node/AbstractNodeTest.php +++ b/Tests/Node/AbstractNodeTest.php @@ -28,7 +28,7 @@ public function testSpecificityValue(NodeInterface $node, $value) $this->assertEquals($value, $node->getSpecificity()->getValue()); } - abstract public function getToStringConversionTestData(); + abstract public static function getToStringConversionTestData(); - abstract public function getSpecificityValueTestData(); + abstract public static function getSpecificityValueTestData(); } diff --git a/Tests/Node/AttributeNodeTest.php b/Tests/Node/AttributeNodeTest.php index 4d60074..fc17a84 100644 --- a/Tests/Node/AttributeNodeTest.php +++ b/Tests/Node/AttributeNodeTest.php @@ -16,7 +16,7 @@ class AttributeNodeTest extends AbstractNodeTest { - public function getToStringConversionTestData() + public static function getToStringConversionTestData() { return [ [new AttributeNode(new ElementNode(), null, 'attribute', 'exists', null), 'Attribute[Element[*][attribute]]'], @@ -25,7 +25,7 @@ public function getToStringConversionTestData() ]; } - public function getSpecificityValueTestData() + public static function getSpecificityValueTestData() { return [ [new AttributeNode(new ElementNode(), null, 'attribute', 'exists', null), 10], diff --git a/Tests/Node/ClassNodeTest.php b/Tests/Node/ClassNodeTest.php index aa80c92..5a1b9d4 100644 --- a/Tests/Node/ClassNodeTest.php +++ b/Tests/Node/ClassNodeTest.php @@ -16,14 +16,14 @@ class ClassNodeTest extends AbstractNodeTest { - public function getToStringConversionTestData() + public static function getToStringConversionTestData() { return [ [new ClassNode(new ElementNode(), 'class'), 'Class[Element[*].class]'], ]; } - public function getSpecificityValueTestData() + public static function getSpecificityValueTestData() { return [ [new ClassNode(new ElementNode(), 'class'), 10], diff --git a/Tests/Node/CombinedSelectorNodeTest.php b/Tests/Node/CombinedSelectorNodeTest.php index 435eaa6..c5c5116 100644 --- a/Tests/Node/CombinedSelectorNodeTest.php +++ b/Tests/Node/CombinedSelectorNodeTest.php @@ -16,7 +16,7 @@ class CombinedSelectorNodeTest extends AbstractNodeTest { - public function getToStringConversionTestData() + public static function getToStringConversionTestData() { return [ [new CombinedSelectorNode(new ElementNode(), '>', new ElementNode()), 'CombinedSelector[Element[*] > Element[*]]'], @@ -24,7 +24,7 @@ public function getToStringConversionTestData() ]; } - public function getSpecificityValueTestData() + public static function getSpecificityValueTestData() { return [ [new CombinedSelectorNode(new ElementNode(), '>', new ElementNode()), 0], diff --git a/Tests/Node/ElementNodeTest.php b/Tests/Node/ElementNodeTest.php index e0797ff..303dbcd 100644 --- a/Tests/Node/ElementNodeTest.php +++ b/Tests/Node/ElementNodeTest.php @@ -15,7 +15,7 @@ class ElementNodeTest extends AbstractNodeTest { - public function getToStringConversionTestData() + public static function getToStringConversionTestData() { return [ [new ElementNode(), 'Element[*]'], @@ -24,7 +24,7 @@ public function getToStringConversionTestData() ]; } - public function getSpecificityValueTestData() + public static function getSpecificityValueTestData() { return [ [new ElementNode(), 0], diff --git a/Tests/Node/FunctionNodeTest.php b/Tests/Node/FunctionNodeTest.php index 0932393..58ff5fd 100644 --- a/Tests/Node/FunctionNodeTest.php +++ b/Tests/Node/FunctionNodeTest.php @@ -17,7 +17,7 @@ class FunctionNodeTest extends AbstractNodeTest { - public function getToStringConversionTestData() + public static function getToStringConversionTestData() { return [ [new FunctionNode(new ElementNode(), 'function'), 'Function[Element[*]:function()]'], @@ -31,7 +31,7 @@ public function getToStringConversionTestData() ]; } - public function getSpecificityValueTestData() + public static function getSpecificityValueTestData() { return [ [new FunctionNode(new ElementNode(), 'function'), 10], diff --git a/Tests/Node/HashNodeTest.php b/Tests/Node/HashNodeTest.php index ad6765b..479cca7 100644 --- a/Tests/Node/HashNodeTest.php +++ b/Tests/Node/HashNodeTest.php @@ -16,14 +16,14 @@ class HashNodeTest extends AbstractNodeTest { - public function getToStringConversionTestData() + public static function getToStringConversionTestData() { return [ [new HashNode(new ElementNode(), 'id'), 'Hash[Element[*]#id]'], ]; } - public function getSpecificityValueTestData() + public static function getSpecificityValueTestData() { return [ [new HashNode(new ElementNode(), 'id'), 100], diff --git a/Tests/Node/NegationNodeTest.php b/Tests/Node/NegationNodeTest.php index 90b684c..8c04ad9 100644 --- a/Tests/Node/NegationNodeTest.php +++ b/Tests/Node/NegationNodeTest.php @@ -17,14 +17,14 @@ class NegationNodeTest extends AbstractNodeTest { - public function getToStringConversionTestData() + public static function getToStringConversionTestData() { return [ [new NegationNode(new ElementNode(), new ClassNode(new ElementNode(), 'class')), 'Negation[Element[*]:not(Class[Element[*].class])]'], ]; } - public function getSpecificityValueTestData() + public static function getSpecificityValueTestData() { return [ [new NegationNode(new ElementNode(), new ClassNode(new ElementNode(), 'class')), 10], diff --git a/Tests/Node/PseudoNodeTest.php b/Tests/Node/PseudoNodeTest.php index 4e78776..a5607ef 100644 --- a/Tests/Node/PseudoNodeTest.php +++ b/Tests/Node/PseudoNodeTest.php @@ -16,14 +16,14 @@ class PseudoNodeTest extends AbstractNodeTest { - public function getToStringConversionTestData() + public static function getToStringConversionTestData() { return [ [new PseudoNode(new ElementNode(), 'pseudo'), 'Pseudo[Element[*]:pseudo]'], ]; } - public function getSpecificityValueTestData() + public static function getSpecificityValueTestData() { return [ [new PseudoNode(new ElementNode(), 'pseudo'), 10], diff --git a/Tests/Node/SelectorNodeTest.php b/Tests/Node/SelectorNodeTest.php index 85e3bda..593aa27 100644 --- a/Tests/Node/SelectorNodeTest.php +++ b/Tests/Node/SelectorNodeTest.php @@ -16,7 +16,7 @@ class SelectorNodeTest extends AbstractNodeTest { - public function getToStringConversionTestData() + public static function getToStringConversionTestData() { return [ [new SelectorNode(new ElementNode()), 'Selector[Element[*]]'], @@ -24,7 +24,7 @@ public function getToStringConversionTestData() ]; } - public function getSpecificityValueTestData() + public static function getSpecificityValueTestData() { return [ [new SelectorNode(new ElementNode()), 0], From 66d6be30ae02ae6b881fa44ab2feb733309f3416 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 7 Feb 2023 10:31:13 +0100 Subject: [PATCH 2/2] minor #49253 [PHPUnit 10] Use `TestCase` suffix for abstract tests in `/Tests/` (OskarStark) This PR was merged into the 6.3 branch. Discussion ---------- [PHPUnit 10] Use `TestCase` suffix for abstract tests in `/Tests/` | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | Refs https://github.com/symfony/symfony/pull/49233 | License | MIT | Doc PR | n/a Replaces #49234 Using `Test` suffix is deprecated since PHPUnit 10 Spotted in * https://github.com/symfony/symfony/pull/49233 Commits ------- cb3db968e4 [PHPUnit 10] Use `TestCase` suffix for abstract tests in `/Tests/` --- Tests/Node/{AbstractNodeTest.php => AbstractNodeTestCase.php} | 2 +- Tests/Node/AttributeNodeTest.php | 2 +- Tests/Node/ClassNodeTest.php | 2 +- Tests/Node/CombinedSelectorNodeTest.php | 2 +- Tests/Node/ElementNodeTest.php | 2 +- Tests/Node/FunctionNodeTest.php | 2 +- Tests/Node/HashNodeTest.php | 2 +- Tests/Node/NegationNodeTest.php | 2 +- Tests/Node/PseudoNodeTest.php | 2 +- Tests/Node/SelectorNodeTest.php | 2 +- .../{AbstractHandlerTest.php => AbstractHandlerTestCase.php} | 2 +- Tests/Parser/Handler/CommentHandlerTest.php | 2 +- Tests/Parser/Handler/HashHandlerTest.php | 2 +- Tests/Parser/Handler/IdentifierHandlerTest.php | 2 +- Tests/Parser/Handler/NumberHandlerTest.php | 2 +- Tests/Parser/Handler/StringHandlerTest.php | 2 +- Tests/Parser/Handler/WhitespaceHandlerTest.php | 2 +- 17 files changed, 17 insertions(+), 17 deletions(-) rename Tests/Node/{AbstractNodeTest.php => AbstractNodeTestCase.php} (94%) rename Tests/Parser/Handler/{AbstractHandlerTest.php => AbstractHandlerTestCase.php} (97%) diff --git a/Tests/Node/AbstractNodeTest.php b/Tests/Node/AbstractNodeTestCase.php similarity index 94% rename from Tests/Node/AbstractNodeTest.php rename to Tests/Node/AbstractNodeTestCase.php index 85fe646..521e6d8 100644 --- a/Tests/Node/AbstractNodeTest.php +++ b/Tests/Node/AbstractNodeTestCase.php @@ -14,7 +14,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\CssSelector\Node\NodeInterface; -abstract class AbstractNodeTest extends TestCase +abstract class AbstractNodeTestCase extends TestCase { /** @dataProvider getToStringConversionTestData */ public function testToStringConversion(NodeInterface $node, $representation) diff --git a/Tests/Node/AttributeNodeTest.php b/Tests/Node/AttributeNodeTest.php index fc17a84..62364c4 100644 --- a/Tests/Node/AttributeNodeTest.php +++ b/Tests/Node/AttributeNodeTest.php @@ -14,7 +14,7 @@ use Symfony\Component\CssSelector\Node\AttributeNode; use Symfony\Component\CssSelector\Node\ElementNode; -class AttributeNodeTest extends AbstractNodeTest +class AttributeNodeTest extends AbstractNodeTestCase { public static function getToStringConversionTestData() { diff --git a/Tests/Node/ClassNodeTest.php b/Tests/Node/ClassNodeTest.php index 5a1b9d4..3c0c67a 100644 --- a/Tests/Node/ClassNodeTest.php +++ b/Tests/Node/ClassNodeTest.php @@ -14,7 +14,7 @@ use Symfony\Component\CssSelector\Node\ClassNode; use Symfony\Component\CssSelector\Node\ElementNode; -class ClassNodeTest extends AbstractNodeTest +class ClassNodeTest extends AbstractNodeTestCase { public static function getToStringConversionTestData() { diff --git a/Tests/Node/CombinedSelectorNodeTest.php b/Tests/Node/CombinedSelectorNodeTest.php index c5c5116..bf9ed06 100644 --- a/Tests/Node/CombinedSelectorNodeTest.php +++ b/Tests/Node/CombinedSelectorNodeTest.php @@ -14,7 +14,7 @@ use Symfony\Component\CssSelector\Node\CombinedSelectorNode; use Symfony\Component\CssSelector\Node\ElementNode; -class CombinedSelectorNodeTest extends AbstractNodeTest +class CombinedSelectorNodeTest extends AbstractNodeTestCase { public static function getToStringConversionTestData() { diff --git a/Tests/Node/ElementNodeTest.php b/Tests/Node/ElementNodeTest.php index 303dbcd..e864eec 100644 --- a/Tests/Node/ElementNodeTest.php +++ b/Tests/Node/ElementNodeTest.php @@ -13,7 +13,7 @@ use Symfony\Component\CssSelector\Node\ElementNode; -class ElementNodeTest extends AbstractNodeTest +class ElementNodeTest extends AbstractNodeTestCase { public static function getToStringConversionTestData() { diff --git a/Tests/Node/FunctionNodeTest.php b/Tests/Node/FunctionNodeTest.php index 58ff5fd..b8d2e7a 100644 --- a/Tests/Node/FunctionNodeTest.php +++ b/Tests/Node/FunctionNodeTest.php @@ -15,7 +15,7 @@ use Symfony\Component\CssSelector\Node\FunctionNode; use Symfony\Component\CssSelector\Parser\Token; -class FunctionNodeTest extends AbstractNodeTest +class FunctionNodeTest extends AbstractNodeTestCase { public static function getToStringConversionTestData() { diff --git a/Tests/Node/HashNodeTest.php b/Tests/Node/HashNodeTest.php index 479cca7..a33cdd9 100644 --- a/Tests/Node/HashNodeTest.php +++ b/Tests/Node/HashNodeTest.php @@ -14,7 +14,7 @@ use Symfony\Component\CssSelector\Node\ElementNode; use Symfony\Component\CssSelector\Node\HashNode; -class HashNodeTest extends AbstractNodeTest +class HashNodeTest extends AbstractNodeTestCase { public static function getToStringConversionTestData() { diff --git a/Tests/Node/NegationNodeTest.php b/Tests/Node/NegationNodeTest.php index 8c04ad9..f90fa36 100644 --- a/Tests/Node/NegationNodeTest.php +++ b/Tests/Node/NegationNodeTest.php @@ -15,7 +15,7 @@ use Symfony\Component\CssSelector\Node\ElementNode; use Symfony\Component\CssSelector\Node\NegationNode; -class NegationNodeTest extends AbstractNodeTest +class NegationNodeTest extends AbstractNodeTestCase { public static function getToStringConversionTestData() { diff --git a/Tests/Node/PseudoNodeTest.php b/Tests/Node/PseudoNodeTest.php index a5607ef..f4c7404 100644 --- a/Tests/Node/PseudoNodeTest.php +++ b/Tests/Node/PseudoNodeTest.php @@ -14,7 +14,7 @@ use Symfony\Component\CssSelector\Node\ElementNode; use Symfony\Component\CssSelector\Node\PseudoNode; -class PseudoNodeTest extends AbstractNodeTest +class PseudoNodeTest extends AbstractNodeTestCase { public static function getToStringConversionTestData() { diff --git a/Tests/Node/SelectorNodeTest.php b/Tests/Node/SelectorNodeTest.php index 593aa27..3bf6666 100644 --- a/Tests/Node/SelectorNodeTest.php +++ b/Tests/Node/SelectorNodeTest.php @@ -14,7 +14,7 @@ use Symfony\Component\CssSelector\Node\ElementNode; use Symfony\Component\CssSelector\Node\SelectorNode; -class SelectorNodeTest extends AbstractNodeTest +class SelectorNodeTest extends AbstractNodeTestCase { public static function getToStringConversionTestData() { diff --git a/Tests/Parser/Handler/AbstractHandlerTest.php b/Tests/Parser/Handler/AbstractHandlerTestCase.php similarity index 97% rename from Tests/Parser/Handler/AbstractHandlerTest.php rename to Tests/Parser/Handler/AbstractHandlerTestCase.php index aaed55c..6bf810b 100644 --- a/Tests/Parser/Handler/AbstractHandlerTest.php +++ b/Tests/Parser/Handler/AbstractHandlerTestCase.php @@ -19,7 +19,7 @@ /** * @author Jean-François Simon */ -abstract class AbstractHandlerTest extends TestCase +abstract class AbstractHandlerTestCase extends TestCase { /** @dataProvider getHandleValueTestData */ public function testHandleValue($value, Token $expectedToken, $remainingContent) diff --git a/Tests/Parser/Handler/CommentHandlerTest.php b/Tests/Parser/Handler/CommentHandlerTest.php index de40047..59eaeba 100644 --- a/Tests/Parser/Handler/CommentHandlerTest.php +++ b/Tests/Parser/Handler/CommentHandlerTest.php @@ -16,7 +16,7 @@ use Symfony\Component\CssSelector\Parser\Token; use Symfony\Component\CssSelector\Parser\TokenStream; -class CommentHandlerTest extends AbstractHandlerTest +class CommentHandlerTest extends AbstractHandlerTestCase { /** @dataProvider getHandleValueTestData */ public function testHandleValue($value, Token $unusedArgument, $remainingContent) diff --git a/Tests/Parser/Handler/HashHandlerTest.php b/Tests/Parser/Handler/HashHandlerTest.php index 9444f51..a156305 100644 --- a/Tests/Parser/Handler/HashHandlerTest.php +++ b/Tests/Parser/Handler/HashHandlerTest.php @@ -16,7 +16,7 @@ use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerEscaping; use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns; -class HashHandlerTest extends AbstractHandlerTest +class HashHandlerTest extends AbstractHandlerTestCase { public function getHandleValueTestData() { diff --git a/Tests/Parser/Handler/IdentifierHandlerTest.php b/Tests/Parser/Handler/IdentifierHandlerTest.php index c54ba53..3bc35a9 100644 --- a/Tests/Parser/Handler/IdentifierHandlerTest.php +++ b/Tests/Parser/Handler/IdentifierHandlerTest.php @@ -16,7 +16,7 @@ use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerEscaping; use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns; -class IdentifierHandlerTest extends AbstractHandlerTest +class IdentifierHandlerTest extends AbstractHandlerTestCase { public function getHandleValueTestData() { diff --git a/Tests/Parser/Handler/NumberHandlerTest.php b/Tests/Parser/Handler/NumberHandlerTest.php index b43d369..07a6018 100644 --- a/Tests/Parser/Handler/NumberHandlerTest.php +++ b/Tests/Parser/Handler/NumberHandlerTest.php @@ -15,7 +15,7 @@ use Symfony\Component\CssSelector\Parser\Token; use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns; -class NumberHandlerTest extends AbstractHandlerTest +class NumberHandlerTest extends AbstractHandlerTestCase { public function getHandleValueTestData() { diff --git a/Tests/Parser/Handler/StringHandlerTest.php b/Tests/Parser/Handler/StringHandlerTest.php index baa7273..133ae38 100644 --- a/Tests/Parser/Handler/StringHandlerTest.php +++ b/Tests/Parser/Handler/StringHandlerTest.php @@ -16,7 +16,7 @@ use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerEscaping; use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns; -class StringHandlerTest extends AbstractHandlerTest +class StringHandlerTest extends AbstractHandlerTestCase { public function getHandleValueTestData() { diff --git a/Tests/Parser/Handler/WhitespaceHandlerTest.php b/Tests/Parser/Handler/WhitespaceHandlerTest.php index 67509ef..7a1b893 100644 --- a/Tests/Parser/Handler/WhitespaceHandlerTest.php +++ b/Tests/Parser/Handler/WhitespaceHandlerTest.php @@ -14,7 +14,7 @@ use Symfony\Component\CssSelector\Parser\Handler\WhitespaceHandler; use Symfony\Component\CssSelector\Parser\Token; -class WhitespaceHandlerTest extends AbstractHandlerTest +class WhitespaceHandlerTest extends AbstractHandlerTestCase { public function getHandleValueTestData() {