From 80b5656d6cef3a7a8d2cc82472caa128c33abecf Mon Sep 17 00:00:00 2001 From: jrfnl Date: Thu, 14 Nov 2024 01:58:05 +0100 Subject: [PATCH] Tests/Ruleset/fixtures: move existing fixtures to subdirectory For some new tests, some test fixtures outside a standard directory structure and/or in a seperate standard directory structure are needed. This commit moves the pre-existing sniff test fixtures to a subdirectory to allow for the upcoming additional test fixtures. Includes updating the standard/ruleset to have a namespace prefix ("Fixtures"), so that aspect of things can now also be tested. --- tests/Core/Ruleset/ExplainTest.php | 22 ++++---- .../Deprecated/WithLongReplacementSniff.php | 2 +- ...eplacementContainingLinuxNewlinesSniff.php | 2 +- ...WithReplacementContainingNewlinesSniff.php | 2 +- .../Deprecated/WithReplacementSniff.php | 2 +- .../Deprecated/WithoutReplacementSniff.php | 2 +- .../EmptyDeprecationVersionSniff.php | 2 +- .../EmptyRemovalVersionSniff.php | 2 +- .../InvalidDeprecationMessageSniff.php | 2 +- .../InvalidDeprecationVersionSniff.php | 2 +- .../InvalidRemovalVersionSniff.php | 2 +- .../SetProperty/AllowedAsDeclaredSniff.php | 2 +- .../AllowedViaMagicMethodSniff.php | 2 +- .../SetProperty/AllowedViaStdClassSniff.php | 2 +- .../NotAllowedViaAttributeSniff.php | 2 +- .../Ruleset/Fixtures/TestStandard/ruleset.xml | 4 ++ tests/Core/Ruleset/Fixtures/ruleset.xml | 4 -- .../SetPropertyAllowedAsDeclaredTest.xml | 2 +- .../SetPropertyAllowedViaMagicMethodTest.xml | 2 +- .../SetPropertyAllowedViaStdClassTest.xml | 2 +- .../SetPropertyNotAllowedViaAttributeTest.xml | 2 +- tests/Core/Ruleset/SetSniffPropertyTest.php | 16 +++--- ...eprecationsEmptyDeprecationVersionTest.xml | 4 +- ...iffDeprecationsEmptyRemovalVersionTest.xml | 4 +- ...recationsInvalidDeprecationMessageTest.xml | 4 +- ...recationsInvalidDeprecationVersionTest.xml | 4 +- ...fDeprecationsInvalidRemovalVersionTest.xml | 4 +- .../ShowSniffDeprecationsOrderTest.xml | 6 +-- .../ShowSniffDeprecationsReportWidthTest.xml | 4 +- .../Ruleset/ShowSniffDeprecationsTest.php | 50 +++++++++---------- .../Ruleset/ShowSniffDeprecationsTest.xml | 6 +-- 31 files changed, 84 insertions(+), 84 deletions(-) rename tests/Core/Ruleset/Fixtures/{ => TestStandard}/Sniffs/Deprecated/WithLongReplacementSniff.php (96%) rename tests/Core/Ruleset/Fixtures/{ => TestStandard}/Sniffs/Deprecated/WithReplacementContainingLinuxNewlinesSniff.php (95%) rename tests/Core/Ruleset/Fixtures/{ => TestStandard}/Sniffs/Deprecated/WithReplacementContainingNewlinesSniff.php (95%) rename tests/Core/Ruleset/Fixtures/{ => TestStandard}/Sniffs/Deprecated/WithReplacementSniff.php (93%) rename tests/Core/Ruleset/Fixtures/{ => TestStandard}/Sniffs/Deprecated/WithoutReplacementSniff.php (93%) rename tests/Core/Ruleset/Fixtures/{ => TestStandard}/Sniffs/DeprecatedInvalid/EmptyDeprecationVersionSniff.php (92%) rename tests/Core/Ruleset/Fixtures/{ => TestStandard}/Sniffs/DeprecatedInvalid/EmptyRemovalVersionSniff.php (92%) rename tests/Core/Ruleset/Fixtures/{ => TestStandard}/Sniffs/DeprecatedInvalid/InvalidDeprecationMessageSniff.php (92%) rename tests/Core/Ruleset/Fixtures/{ => TestStandard}/Sniffs/DeprecatedInvalid/InvalidDeprecationVersionSniff.php (92%) rename tests/Core/Ruleset/Fixtures/{ => TestStandard}/Sniffs/DeprecatedInvalid/InvalidRemovalVersionSniff.php (92%) rename tests/Core/Ruleset/Fixtures/{ => TestStandard}/Sniffs/SetProperty/AllowedAsDeclaredSniff.php (89%) rename tests/Core/Ruleset/Fixtures/{ => TestStandard}/Sniffs/SetProperty/AllowedViaMagicMethodSniff.php (92%) rename tests/Core/Ruleset/Fixtures/{ => TestStandard}/Sniffs/SetProperty/AllowedViaStdClassSniff.php (88%) rename tests/Core/Ruleset/Fixtures/{ => TestStandard}/Sniffs/SetProperty/NotAllowedViaAttributeSniff.php (89%) create mode 100644 tests/Core/Ruleset/Fixtures/TestStandard/ruleset.xml delete mode 100644 tests/Core/Ruleset/Fixtures/ruleset.xml diff --git a/tests/Core/Ruleset/ExplainTest.php b/tests/Core/Ruleset/ExplainTest.php index 0d899608df..48df24f473 100644 --- a/tests/Core/Ruleset/ExplainTest.php +++ b/tests/Core/Ruleset/ExplainTest.php @@ -187,17 +187,17 @@ public function testExplainWithDeprecatedSniffs() $expected = PHP_EOL; $expected .= 'The ShowSniffDeprecationsTest standard contains 9 sniffs'.PHP_EOL.PHP_EOL; - $expected .= 'Fixtures (9 sniffs)'.PHP_EOL; - $expected .= '-------------------'.PHP_EOL; - $expected .= ' Fixtures.Deprecated.WithLongReplacement *'.PHP_EOL; - $expected .= ' Fixtures.Deprecated.WithoutReplacement *'.PHP_EOL; - $expected .= ' Fixtures.Deprecated.WithReplacement *'.PHP_EOL; - $expected .= ' Fixtures.Deprecated.WithReplacementContainingLinuxNewlines *'.PHP_EOL; - $expected .= ' Fixtures.Deprecated.WithReplacementContainingNewlines *'.PHP_EOL; - $expected .= ' Fixtures.SetProperty.AllowedAsDeclared'.PHP_EOL; - $expected .= ' Fixtures.SetProperty.AllowedViaMagicMethod'.PHP_EOL; - $expected .= ' Fixtures.SetProperty.AllowedViaStdClass'.PHP_EOL; - $expected .= ' Fixtures.SetProperty.NotAllowedViaAttribute'.PHP_EOL.PHP_EOL; + $expected .= 'TestStandard (9 sniffs)'.PHP_EOL; + $expected .= '-----------------------'.PHP_EOL; + $expected .= ' TestStandard.Deprecated.WithLongReplacement *'.PHP_EOL; + $expected .= ' TestStandard.Deprecated.WithoutReplacement *'.PHP_EOL; + $expected .= ' TestStandard.Deprecated.WithReplacement *'.PHP_EOL; + $expected .= ' TestStandard.Deprecated.WithReplacementContainingLinuxNewlines *'.PHP_EOL; + $expected .= ' TestStandard.Deprecated.WithReplacementContainingNewlines *'.PHP_EOL; + $expected .= ' TestStandard.SetProperty.AllowedAsDeclared'.PHP_EOL; + $expected .= ' TestStandard.SetProperty.AllowedViaMagicMethod'.PHP_EOL; + $expected .= ' TestStandard.SetProperty.AllowedViaStdClass'.PHP_EOL; + $expected .= ' TestStandard.SetProperty.NotAllowedViaAttribute'.PHP_EOL.PHP_EOL; $expected .= '* Sniffs marked with an asterix are deprecated.'.PHP_EOL; diff --git a/tests/Core/Ruleset/Fixtures/Sniffs/Deprecated/WithLongReplacementSniff.php b/tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/Deprecated/WithLongReplacementSniff.php similarity index 96% rename from tests/Core/Ruleset/Fixtures/Sniffs/Deprecated/WithLongReplacementSniff.php rename to tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/Deprecated/WithLongReplacementSniff.php index 40c23113d5..659d89ee2a 100644 --- a/tests/Core/Ruleset/Fixtures/Sniffs/Deprecated/WithLongReplacementSniff.php +++ b/tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/Deprecated/WithLongReplacementSniff.php @@ -5,7 +5,7 @@ * @see \PHP_CodeSniffer\Tests\Core\Ruleset\SniffDeprecationTest */ -namespace Fixtures\Sniffs\Deprecated; +namespace Fixtures\TestStandard\Sniffs\Deprecated; use PHP_CodeSniffer\Files\File; use PHP_CodeSniffer\Sniffs\DeprecatedSniff; diff --git a/tests/Core/Ruleset/Fixtures/Sniffs/Deprecated/WithReplacementContainingLinuxNewlinesSniff.php b/tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/Deprecated/WithReplacementContainingLinuxNewlinesSniff.php similarity index 95% rename from tests/Core/Ruleset/Fixtures/Sniffs/Deprecated/WithReplacementContainingLinuxNewlinesSniff.php rename to tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/Deprecated/WithReplacementContainingLinuxNewlinesSniff.php index 0363927db7..d870cbf7e4 100644 --- a/tests/Core/Ruleset/Fixtures/Sniffs/Deprecated/WithReplacementContainingLinuxNewlinesSniff.php +++ b/tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/Deprecated/WithReplacementContainingLinuxNewlinesSniff.php @@ -5,7 +5,7 @@ * @see \PHP_CodeSniffer\Tests\Core\Ruleset\SniffDeprecationTest */ -namespace Fixtures\Sniffs\Deprecated; +namespace Fixtures\TestStandard\Sniffs\Deprecated; use PHP_CodeSniffer\Files\File; use PHP_CodeSniffer\Sniffs\DeprecatedSniff; diff --git a/tests/Core/Ruleset/Fixtures/Sniffs/Deprecated/WithReplacementContainingNewlinesSniff.php b/tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/Deprecated/WithReplacementContainingNewlinesSniff.php similarity index 95% rename from tests/Core/Ruleset/Fixtures/Sniffs/Deprecated/WithReplacementContainingNewlinesSniff.php rename to tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/Deprecated/WithReplacementContainingNewlinesSniff.php index e9e76c8c0e..2516d7cd2e 100644 --- a/tests/Core/Ruleset/Fixtures/Sniffs/Deprecated/WithReplacementContainingNewlinesSniff.php +++ b/tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/Deprecated/WithReplacementContainingNewlinesSniff.php @@ -5,7 +5,7 @@ * @see \PHP_CodeSniffer\Tests\Core\Ruleset\SniffDeprecationTest */ -namespace Fixtures\Sniffs\Deprecated; +namespace Fixtures\TestStandard\Sniffs\Deprecated; use PHP_CodeSniffer\Files\File; use PHP_CodeSniffer\Sniffs\DeprecatedSniff; diff --git a/tests/Core/Ruleset/Fixtures/Sniffs/Deprecated/WithReplacementSniff.php b/tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/Deprecated/WithReplacementSniff.php similarity index 93% rename from tests/Core/Ruleset/Fixtures/Sniffs/Deprecated/WithReplacementSniff.php rename to tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/Deprecated/WithReplacementSniff.php index a633982817..1953448672 100644 --- a/tests/Core/Ruleset/Fixtures/Sniffs/Deprecated/WithReplacementSniff.php +++ b/tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/Deprecated/WithReplacementSniff.php @@ -5,7 +5,7 @@ * @see \PHP_CodeSniffer\Tests\Core\Ruleset\SniffDeprecationTest */ -namespace Fixtures\Sniffs\Deprecated; +namespace Fixtures\TestStandard\Sniffs\Deprecated; use PHP_CodeSniffer\Files\File; use PHP_CodeSniffer\Sniffs\DeprecatedSniff; diff --git a/tests/Core/Ruleset/Fixtures/Sniffs/Deprecated/WithoutReplacementSniff.php b/tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/Deprecated/WithoutReplacementSniff.php similarity index 93% rename from tests/Core/Ruleset/Fixtures/Sniffs/Deprecated/WithoutReplacementSniff.php rename to tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/Deprecated/WithoutReplacementSniff.php index d6d3887106..888e08fd13 100644 --- a/tests/Core/Ruleset/Fixtures/Sniffs/Deprecated/WithoutReplacementSniff.php +++ b/tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/Deprecated/WithoutReplacementSniff.php @@ -5,7 +5,7 @@ * @see \PHP_CodeSniffer\Tests\Core\Ruleset\SniffDeprecationTest */ -namespace Fixtures\Sniffs\Deprecated; +namespace Fixtures\TestStandard\Sniffs\Deprecated; use PHP_CodeSniffer\Files\File; use PHP_CodeSniffer\Sniffs\DeprecatedSniff; diff --git a/tests/Core/Ruleset/Fixtures/Sniffs/DeprecatedInvalid/EmptyDeprecationVersionSniff.php b/tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/DeprecatedInvalid/EmptyDeprecationVersionSniff.php similarity index 92% rename from tests/Core/Ruleset/Fixtures/Sniffs/DeprecatedInvalid/EmptyDeprecationVersionSniff.php rename to tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/DeprecatedInvalid/EmptyDeprecationVersionSniff.php index 8d3dcd4218..4e26b7b761 100644 --- a/tests/Core/Ruleset/Fixtures/Sniffs/DeprecatedInvalid/EmptyDeprecationVersionSniff.php +++ b/tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/DeprecatedInvalid/EmptyDeprecationVersionSniff.php @@ -5,7 +5,7 @@ * @see \PHP_CodeSniffer\Tests\Core\Ruleset\SniffDeprecationTest */ -namespace Fixtures\Sniffs\DeprecatedInvalid; +namespace Fixtures\TestStandard\Sniffs\DeprecatedInvalid; use PHP_CodeSniffer\Files\File; use PHP_CodeSniffer\Sniffs\DeprecatedSniff; diff --git a/tests/Core/Ruleset/Fixtures/Sniffs/DeprecatedInvalid/EmptyRemovalVersionSniff.php b/tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/DeprecatedInvalid/EmptyRemovalVersionSniff.php similarity index 92% rename from tests/Core/Ruleset/Fixtures/Sniffs/DeprecatedInvalid/EmptyRemovalVersionSniff.php rename to tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/DeprecatedInvalid/EmptyRemovalVersionSniff.php index 828b169284..cdf15c3031 100644 --- a/tests/Core/Ruleset/Fixtures/Sniffs/DeprecatedInvalid/EmptyRemovalVersionSniff.php +++ b/tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/DeprecatedInvalid/EmptyRemovalVersionSniff.php @@ -5,7 +5,7 @@ * @see \PHP_CodeSniffer\Tests\Core\Ruleset\SniffDeprecationTest */ -namespace Fixtures\Sniffs\DeprecatedInvalid; +namespace Fixtures\TestStandard\Sniffs\DeprecatedInvalid; use PHP_CodeSniffer\Files\File; use PHP_CodeSniffer\Sniffs\DeprecatedSniff; diff --git a/tests/Core/Ruleset/Fixtures/Sniffs/DeprecatedInvalid/InvalidDeprecationMessageSniff.php b/tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/DeprecatedInvalid/InvalidDeprecationMessageSniff.php similarity index 92% rename from tests/Core/Ruleset/Fixtures/Sniffs/DeprecatedInvalid/InvalidDeprecationMessageSniff.php rename to tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/DeprecatedInvalid/InvalidDeprecationMessageSniff.php index a6819825f7..368bd4140b 100644 --- a/tests/Core/Ruleset/Fixtures/Sniffs/DeprecatedInvalid/InvalidDeprecationMessageSniff.php +++ b/tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/DeprecatedInvalid/InvalidDeprecationMessageSniff.php @@ -5,7 +5,7 @@ * @see \PHP_CodeSniffer\Tests\Core\Ruleset\SniffDeprecationTest */ -namespace Fixtures\Sniffs\DeprecatedInvalid; +namespace Fixtures\TestStandard\Sniffs\DeprecatedInvalid; use PHP_CodeSniffer\Files\File; use PHP_CodeSniffer\Sniffs\DeprecatedSniff; diff --git a/tests/Core/Ruleset/Fixtures/Sniffs/DeprecatedInvalid/InvalidDeprecationVersionSniff.php b/tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/DeprecatedInvalid/InvalidDeprecationVersionSniff.php similarity index 92% rename from tests/Core/Ruleset/Fixtures/Sniffs/DeprecatedInvalid/InvalidDeprecationVersionSniff.php rename to tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/DeprecatedInvalid/InvalidDeprecationVersionSniff.php index d51aa876ca..b8218ad57e 100644 --- a/tests/Core/Ruleset/Fixtures/Sniffs/DeprecatedInvalid/InvalidDeprecationVersionSniff.php +++ b/tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/DeprecatedInvalid/InvalidDeprecationVersionSniff.php @@ -5,7 +5,7 @@ * @see \PHP_CodeSniffer\Tests\Core\Ruleset\SniffDeprecationTest */ -namespace Fixtures\Sniffs\DeprecatedInvalid; +namespace Fixtures\TestStandard\Sniffs\DeprecatedInvalid; use PHP_CodeSniffer\Files\File; use PHP_CodeSniffer\Sniffs\DeprecatedSniff; diff --git a/tests/Core/Ruleset/Fixtures/Sniffs/DeprecatedInvalid/InvalidRemovalVersionSniff.php b/tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/DeprecatedInvalid/InvalidRemovalVersionSniff.php similarity index 92% rename from tests/Core/Ruleset/Fixtures/Sniffs/DeprecatedInvalid/InvalidRemovalVersionSniff.php rename to tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/DeprecatedInvalid/InvalidRemovalVersionSniff.php index a10997bbcd..1177e73338 100644 --- a/tests/Core/Ruleset/Fixtures/Sniffs/DeprecatedInvalid/InvalidRemovalVersionSniff.php +++ b/tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/DeprecatedInvalid/InvalidRemovalVersionSniff.php @@ -5,7 +5,7 @@ * @see \PHP_CodeSniffer\Tests\Core\Ruleset\SniffDeprecationTest */ -namespace Fixtures\Sniffs\DeprecatedInvalid; +namespace Fixtures\TestStandard\Sniffs\DeprecatedInvalid; use PHP_CodeSniffer\Files\File; use PHP_CodeSniffer\Sniffs\DeprecatedSniff; diff --git a/tests/Core/Ruleset/Fixtures/Sniffs/SetProperty/AllowedAsDeclaredSniff.php b/tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/SetProperty/AllowedAsDeclaredSniff.php similarity index 89% rename from tests/Core/Ruleset/Fixtures/Sniffs/SetProperty/AllowedAsDeclaredSniff.php rename to tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/SetProperty/AllowedAsDeclaredSniff.php index c26160b279..a8f0364c54 100644 --- a/tests/Core/Ruleset/Fixtures/Sniffs/SetProperty/AllowedAsDeclaredSniff.php +++ b/tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/SetProperty/AllowedAsDeclaredSniff.php @@ -5,7 +5,7 @@ * @see \PHP_CodeSniffer\Tests\Core\Ruleset\SetSniffPropertyTest */ -namespace Fixtures\Sniffs\SetProperty; +namespace Fixtures\TestStandard\Sniffs\SetProperty; use PHP_CodeSniffer\Files\File; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/tests/Core/Ruleset/Fixtures/Sniffs/SetProperty/AllowedViaMagicMethodSniff.php b/tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/SetProperty/AllowedViaMagicMethodSniff.php similarity index 92% rename from tests/Core/Ruleset/Fixtures/Sniffs/SetProperty/AllowedViaMagicMethodSniff.php rename to tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/SetProperty/AllowedViaMagicMethodSniff.php index 04097bb91a..98eb22c573 100644 --- a/tests/Core/Ruleset/Fixtures/Sniffs/SetProperty/AllowedViaMagicMethodSniff.php +++ b/tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/SetProperty/AllowedViaMagicMethodSniff.php @@ -5,7 +5,7 @@ * @see \PHP_CodeSniffer\Tests\Core\Ruleset\SetSniffPropertyTest */ -namespace Fixtures\Sniffs\SetProperty; +namespace Fixtures\TestStandard\Sniffs\SetProperty; use PHP_CodeSniffer\Files\File; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/tests/Core/Ruleset/Fixtures/Sniffs/SetProperty/AllowedViaStdClassSniff.php b/tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/SetProperty/AllowedViaStdClassSniff.php similarity index 88% rename from tests/Core/Ruleset/Fixtures/Sniffs/SetProperty/AllowedViaStdClassSniff.php rename to tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/SetProperty/AllowedViaStdClassSniff.php index 30418729dc..0f58b2e001 100644 --- a/tests/Core/Ruleset/Fixtures/Sniffs/SetProperty/AllowedViaStdClassSniff.php +++ b/tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/SetProperty/AllowedViaStdClassSniff.php @@ -5,7 +5,7 @@ * @see \PHP_CodeSniffer\Tests\Core\Ruleset\SetSniffPropertyTest */ -namespace Fixtures\Sniffs\SetProperty; +namespace Fixtures\TestStandard\Sniffs\SetProperty; use PHP_CodeSniffer\Files\File; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/tests/Core/Ruleset/Fixtures/Sniffs/SetProperty/NotAllowedViaAttributeSniff.php b/tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/SetProperty/NotAllowedViaAttributeSniff.php similarity index 89% rename from tests/Core/Ruleset/Fixtures/Sniffs/SetProperty/NotAllowedViaAttributeSniff.php rename to tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/SetProperty/NotAllowedViaAttributeSniff.php index e895a87a8b..bb52355827 100644 --- a/tests/Core/Ruleset/Fixtures/Sniffs/SetProperty/NotAllowedViaAttributeSniff.php +++ b/tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/SetProperty/NotAllowedViaAttributeSniff.php @@ -5,7 +5,7 @@ * @see \PHP_CodeSniffer\Tests\Core\Ruleset\SetSniffPropertyTest */ -namespace Fixtures\Sniffs\SetProperty; +namespace Fixtures\TestStandard\Sniffs\SetProperty; use AllowDynamicProperties; use PHP_CodeSniffer\Files\File; diff --git a/tests/Core/Ruleset/Fixtures/TestStandard/ruleset.xml b/tests/Core/Ruleset/Fixtures/TestStandard/ruleset.xml new file mode 100644 index 0000000000..345c4837eb --- /dev/null +++ b/tests/Core/Ruleset/Fixtures/TestStandard/ruleset.xml @@ -0,0 +1,4 @@ + + + + diff --git a/tests/Core/Ruleset/Fixtures/ruleset.xml b/tests/Core/Ruleset/Fixtures/ruleset.xml deleted file mode 100644 index 11a899adae..0000000000 --- a/tests/Core/Ruleset/Fixtures/ruleset.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/tests/Core/Ruleset/SetPropertyAllowedAsDeclaredTest.xml b/tests/Core/Ruleset/SetPropertyAllowedAsDeclaredTest.xml index 89005ad2d1..88eaa5ebf9 100644 --- a/tests/Core/Ruleset/SetPropertyAllowedAsDeclaredTest.xml +++ b/tests/Core/Ruleset/SetPropertyAllowedAsDeclaredTest.xml @@ -1,7 +1,7 @@ - + diff --git a/tests/Core/Ruleset/SetPropertyAllowedViaMagicMethodTest.xml b/tests/Core/Ruleset/SetPropertyAllowedViaMagicMethodTest.xml index deb6944d08..e8502e7ff6 100644 --- a/tests/Core/Ruleset/SetPropertyAllowedViaMagicMethodTest.xml +++ b/tests/Core/Ruleset/SetPropertyAllowedViaMagicMethodTest.xml @@ -1,7 +1,7 @@ - + diff --git a/tests/Core/Ruleset/SetPropertyAllowedViaStdClassTest.xml b/tests/Core/Ruleset/SetPropertyAllowedViaStdClassTest.xml index 475ba5cff3..bfbfaf5e6f 100644 --- a/tests/Core/Ruleset/SetPropertyAllowedViaStdClassTest.xml +++ b/tests/Core/Ruleset/SetPropertyAllowedViaStdClassTest.xml @@ -1,7 +1,7 @@ - + diff --git a/tests/Core/Ruleset/SetPropertyNotAllowedViaAttributeTest.xml b/tests/Core/Ruleset/SetPropertyNotAllowedViaAttributeTest.xml index da5423913c..c6a14c259c 100644 --- a/tests/Core/Ruleset/SetPropertyNotAllowedViaAttributeTest.xml +++ b/tests/Core/Ruleset/SetPropertyNotAllowedViaAttributeTest.xml @@ -1,7 +1,7 @@ - + diff --git a/tests/Core/Ruleset/SetSniffPropertyTest.php b/tests/Core/Ruleset/SetSniffPropertyTest.php index 36e6f0097b..51bd0e2989 100644 --- a/tests/Core/Ruleset/SetSniffPropertyTest.php +++ b/tests/Core/Ruleset/SetSniffPropertyTest.php @@ -34,8 +34,8 @@ final class SetSniffPropertyTest extends TestCase */ public function testSniffPropertiesGetSetWhenAllowed($name) { - $sniffCode = "Fixtures.SetProperty.{$name}"; - $sniffClass = 'Fixtures\Sniffs\SetProperty\\'.$name.'Sniff'; + $sniffCode = "TestStandard.SetProperty.{$name}"; + $sniffClass = 'Fixtures\TestStandard\Sniffs\SetProperty\\'.$name.'Sniff'; $properties = [ 'arbitrarystring' => 'arbitraryvalue', 'arbitraryarray' => [ @@ -163,7 +163,7 @@ public function testSetPropertyThrowsErrorOnInvalidProperty() public function testSetPropertyThrowsErrorWhenPropertyOnlyAllowedViaAttribute() { $exceptionClass = 'PHP_CodeSniffer\Exceptions\RuntimeException'; - $exceptionMsg = 'Ruleset invalid. Property "arbitrarystring" does not exist on sniff Fixtures.SetProperty.NotAllowedViaAttribute'; + $exceptionMsg = 'Ruleset invalid. Property "arbitrarystring" does not exist on sniff TestStandard.SetProperty.NotAllowedViaAttribute'; if (method_exists($this, 'expectException') === true) { $this->expectException($exceptionClass); $this->expectExceptionMessage($exceptionMsg); @@ -225,8 +225,8 @@ public function testSetPropertyDoesNotThrowErrorOnInvalidPropertyWhenSetForCateg public function testDirectCallWithNewArrayFormatSetsProperty() { $name = 'AllowedAsDeclared'; - $sniffCode = "Fixtures.SetProperty.{$name}"; - $sniffClass = 'Fixtures\Sniffs\SetProperty\\'.$name.'Sniff'; + $sniffCode = "TestStandard.SetProperty.{$name}"; + $sniffClass = 'Fixtures\TestStandard\Sniffs\SetProperty\\'.$name.'Sniff'; // Set up the ruleset. $standard = __DIR__."/SetProperty{$name}Test.xml"; @@ -276,8 +276,8 @@ public function testDirectCallWithNewArrayFormatSetsProperty() public function testDirectCallWithOldArrayFormatSetsProperty($propertyValue) { $name = 'AllowedAsDeclared'; - $sniffCode = "Fixtures.SetProperty.{$name}"; - $sniffClass = 'Fixtures\Sniffs\SetProperty\\'.$name.'Sniff'; + $sniffCode = "TestStandard.SetProperty.{$name}"; + $sniffClass = 'Fixtures\TestStandard\Sniffs\SetProperty\\'.$name.'Sniff'; // Set up the ruleset. $standard = __DIR__."/SetProperty{$name}Test.xml"; @@ -383,7 +383,7 @@ public function testDirectCallWithOldArrayFormatThrowsDeprecationNotice() } $name = 'AllowedAsDeclared'; - $sniffClass = 'Fixtures\Sniffs\SetProperty\\'.$name.'Sniff'; + $sniffClass = 'Fixtures\TestStandard\Sniffs\SetProperty\\'.$name.'Sniff'; // Set up the ruleset. $standard = __DIR__."/SetProperty{$name}Test.xml"; diff --git a/tests/Core/Ruleset/ShowSniffDeprecationsEmptyDeprecationVersionTest.xml b/tests/Core/Ruleset/ShowSniffDeprecationsEmptyDeprecationVersionTest.xml index f10654fc40..75527e2b1d 100644 --- a/tests/Core/Ruleset/ShowSniffDeprecationsEmptyDeprecationVersionTest.xml +++ b/tests/Core/Ruleset/ShowSniffDeprecationsEmptyDeprecationVersionTest.xml @@ -1,8 +1,8 @@ - + - + diff --git a/tests/Core/Ruleset/ShowSniffDeprecationsEmptyRemovalVersionTest.xml b/tests/Core/Ruleset/ShowSniffDeprecationsEmptyRemovalVersionTest.xml index 0298571804..150fc3e526 100644 --- a/tests/Core/Ruleset/ShowSniffDeprecationsEmptyRemovalVersionTest.xml +++ b/tests/Core/Ruleset/ShowSniffDeprecationsEmptyRemovalVersionTest.xml @@ -1,8 +1,8 @@ - + - + diff --git a/tests/Core/Ruleset/ShowSniffDeprecationsInvalidDeprecationMessageTest.xml b/tests/Core/Ruleset/ShowSniffDeprecationsInvalidDeprecationMessageTest.xml index 295d7b998a..973e065a13 100644 --- a/tests/Core/Ruleset/ShowSniffDeprecationsInvalidDeprecationMessageTest.xml +++ b/tests/Core/Ruleset/ShowSniffDeprecationsInvalidDeprecationMessageTest.xml @@ -1,8 +1,8 @@ - + - + diff --git a/tests/Core/Ruleset/ShowSniffDeprecationsInvalidDeprecationVersionTest.xml b/tests/Core/Ruleset/ShowSniffDeprecationsInvalidDeprecationVersionTest.xml index c7accdf29f..493adfd1ef 100644 --- a/tests/Core/Ruleset/ShowSniffDeprecationsInvalidDeprecationVersionTest.xml +++ b/tests/Core/Ruleset/ShowSniffDeprecationsInvalidDeprecationVersionTest.xml @@ -1,8 +1,8 @@ - + - + diff --git a/tests/Core/Ruleset/ShowSniffDeprecationsInvalidRemovalVersionTest.xml b/tests/Core/Ruleset/ShowSniffDeprecationsInvalidRemovalVersionTest.xml index c5abf66da8..358cb0df5f 100644 --- a/tests/Core/Ruleset/ShowSniffDeprecationsInvalidRemovalVersionTest.xml +++ b/tests/Core/Ruleset/ShowSniffDeprecationsInvalidRemovalVersionTest.xml @@ -1,8 +1,8 @@ - + - + diff --git a/tests/Core/Ruleset/ShowSniffDeprecationsOrderTest.xml b/tests/Core/Ruleset/ShowSniffDeprecationsOrderTest.xml index 6e3f6be53e..fbc0cb7b74 100644 --- a/tests/Core/Ruleset/ShowSniffDeprecationsOrderTest.xml +++ b/tests/Core/Ruleset/ShowSniffDeprecationsOrderTest.xml @@ -1,10 +1,10 @@ - + - - + + diff --git a/tests/Core/Ruleset/ShowSniffDeprecationsReportWidthTest.xml b/tests/Core/Ruleset/ShowSniffDeprecationsReportWidthTest.xml index 8a7870a585..86cc615c4e 100644 --- a/tests/Core/Ruleset/ShowSniffDeprecationsReportWidthTest.xml +++ b/tests/Core/Ruleset/ShowSniffDeprecationsReportWidthTest.xml @@ -1,8 +1,8 @@ - + - + diff --git a/tests/Core/Ruleset/ShowSniffDeprecationsTest.php b/tests/Core/Ruleset/ShowSniffDeprecationsTest.php index bef388bcbc..c31f7b4a83 100644 --- a/tests/Core/Ruleset/ShowSniffDeprecationsTest.php +++ b/tests/Core/Ruleset/ShowSniffDeprecationsTest.php @@ -141,8 +141,8 @@ public function testDeprecatedSniffsListDoesNotShowWhenSelectedSniffsAreNotDepre $restrictions = []; $sniffs = [ - 'Fixtures.SetProperty.AllowedAsDeclared', - 'Fixtures.SetProperty.AllowedViaStdClass', + 'TestStandard.SetProperty.AllowedAsDeclared', + 'TestStandard.SetProperty.AllowedViaStdClass', ]; foreach ($sniffs as $sniffCode) { $parts = explode('.', strtolower($sniffCode)); @@ -187,11 +187,11 @@ public function testDeprecatedSniffsListDoesNotShowWhenAllDeprecatedSniffsAreExc $exclusions = []; $exclude = [ - 'Fixtures.Deprecated.WithLongReplacement', - 'Fixtures.Deprecated.WithoutReplacement', - 'Fixtures.Deprecated.WithReplacement', - 'Fixtures.Deprecated.WithReplacementContainingLinuxNewlines', - 'Fixtures.Deprecated.WithReplacementContainingNewlines', + 'TestStandard.Deprecated.WithLongReplacement', + 'TestStandard.Deprecated.WithoutReplacement', + 'TestStandard.Deprecated.WithReplacement', + 'TestStandard.Deprecated.WithReplacementContainingLinuxNewlines', + 'TestStandard.Deprecated.WithReplacementContainingNewlines', ]; foreach ($exclude as $sniffCode) { $parts = explode('.', strtolower($sniffCode)); @@ -236,7 +236,7 @@ public function testDeprecatedSniffsWarning() $expected = 'WARNING: The ShowSniffDeprecationsTest standard uses 5 deprecated sniffs'.PHP_EOL; $expected .= '--------------------------------------------------------------------------------'.PHP_EOL; - $expected .= '- Fixtures.Deprecated.WithLongReplacement'.PHP_EOL; + $expected .= '- TestStandard.Deprecated.WithLongReplacement'.PHP_EOL; $expected .= ' This sniff has been deprecated since v3.8.0 and will be removed in v4.0.0.'.PHP_EOL; $expected .= ' Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce vel'.PHP_EOL; $expected .= ' vestibulum nunc. Sed luctus dolor tortor, eu euismod purus pretium sed.'.PHP_EOL; @@ -247,12 +247,12 @@ public function testDeprecatedSniffsWarning() $expected .= ' dictum. Suspendisse dictum egestas sapien, eget ullamcorper metus elementum'.PHP_EOL; $expected .= ' semper. Vestibulum sem justo, consectetur ac tincidunt et, finibus eget'.PHP_EOL; $expected .= ' libero.'.PHP_EOL; - $expected .= '- Fixtures.Deprecated.WithoutReplacement'.PHP_EOL; + $expected .= '- TestStandard.Deprecated.WithoutReplacement'.PHP_EOL; $expected .= ' This sniff has been deprecated since v3.4.0 and will be removed in v4.0.0.'.PHP_EOL; - $expected .= '- Fixtures.Deprecated.WithReplacement'.PHP_EOL; + $expected .= '- TestStandard.Deprecated.WithReplacement'.PHP_EOL; $expected .= ' This sniff has been deprecated since v3.8.0 and will be removed in v4.0.0.'.PHP_EOL; $expected .= ' Use the Stnd.Category.OtherSniff sniff instead.'.PHP_EOL; - $expected .= '- Fixtures.Deprecated.WithReplacementContainingLinuxNewlines'.PHP_EOL; + $expected .= '- TestStandard.Deprecated.WithReplacementContainingLinuxNewlines'.PHP_EOL; $expected .= ' This sniff has been deprecated since v3.8.0 and will be removed in v4.0.0.'.PHP_EOL; $expected .= ' Lorem ipsum dolor sit amet, consectetur adipiscing elit.'.PHP_EOL; $expected .= ' Fusce vel vestibulum nunc. Sed luctus dolor tortor, eu euismod purus pretium'.PHP_EOL; @@ -262,7 +262,7 @@ public function testDeprecatedSniffsWarning() $expected .= ' eros sapien at sem.'.PHP_EOL; $expected .= ' Sed pulvinar aliquam malesuada. Aliquam erat volutpat. Mauris gravida rutrum'.PHP_EOL; $expected .= ' lectus at egestas.'.PHP_EOL; - $expected .= '- Fixtures.Deprecated.WithReplacementContainingNewlines'.PHP_EOL; + $expected .= '- TestStandard.Deprecated.WithReplacementContainingNewlines'.PHP_EOL; $expected .= ' This sniff has been deprecated since v3.8.0 and will be removed in v4.0.0.'.PHP_EOL; $expected .= ' Lorem ipsum dolor sit amet, consectetur adipiscing elit.'.PHP_EOL; $expected .= ' Fusce vel vestibulum nunc. Sed luctus dolor tortor, eu euismod purus pretium'.PHP_EOL; @@ -330,7 +330,7 @@ public static function dataReportWidthIsRespected() 'expectedOutput' => 'WARNING: The ShowSniffDeprecationsTest'.PHP_EOL .'standard uses 1 deprecated sniff'.PHP_EOL .'----------------------------------------'.PHP_EOL - .'- Fixtures.Deprecated.WithLongRepla...'.PHP_EOL + .'- TestStandard.Deprecated.WithLongR...'.PHP_EOL .' This sniff has been deprecated since'.PHP_EOL .' v3.8.0 and will be removed in'.PHP_EOL .' v4.0.0. Lorem ipsum dolor sit amet,'.PHP_EOL @@ -358,7 +358,7 @@ public static function dataReportWidthIsRespected() 'Report width default: 80' => [ 'reportWidth' => 80, 'expectedOutput' => $summaryLine.str_repeat('-', 80).PHP_EOL - .'- Fixtures.Deprecated.WithLongReplacement'.PHP_EOL + .'- TestStandard.Deprecated.WithLongReplacement'.PHP_EOL .' This sniff has been deprecated since v3.8.0 and will be removed in v4.0.0.'.PHP_EOL .' Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce vel'.PHP_EOL .' vestibulum nunc. Sed luctus dolor tortor, eu euismod purus pretium sed.'.PHP_EOL @@ -376,7 +376,7 @@ public static function dataReportWidthIsRespected() // Length = 4 padding + 75 base line + 587 custom message. 'reportWidth' => 666, 'expectedOutput' => $summaryLine.str_repeat('-', 666).PHP_EOL - .'- Fixtures.Deprecated.WithLongReplacement'.PHP_EOL + .'- TestStandard.Deprecated.WithLongReplacement'.PHP_EOL .' This sniff has been deprecated since v3.8.0 and will be removed in v4.0.0. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce vel vestibulum nunc. Sed luctus dolor tortor, eu euismod purus pretium sed. Fusce egestas congue massa semper cursus. Donec quis pretium tellus. In lacinia, augue ut ornare porttitor, diam nunc faucibus purus, et accumsan eros sapien at sem. Sed pulvinar aliquam malesuada. Aliquam erat volutpat. Mauris gravida rutrum lectus at egestas. Fusce tempus elit in tincidunt dictum. Suspendisse dictum egestas sapien, eget ullamcorper metus elementum semper. Vestibulum sem justo, consectetur ac tincidunt et, finibus eget libero.' .PHP_EOL.PHP_EOL .'Deprecated sniffs are still run, but will stop working at some point in the future.'.PHP_EOL.PHP_EOL, @@ -384,7 +384,7 @@ public static function dataReportWidthIsRespected() 'Report width wide: 1000; delimiter line length should match longest line' => [ 'reportWidth' => 1000, 'expectedOutput' => $summaryLine.str_repeat('-', 666).PHP_EOL - .'- Fixtures.Deprecated.WithLongReplacement'.PHP_EOL + .'- TestStandard.Deprecated.WithLongReplacement'.PHP_EOL .' This sniff has been deprecated since v3.8.0 and will be removed in v4.0.0. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce vel vestibulum nunc. Sed luctus dolor tortor, eu euismod purus pretium sed. Fusce egestas congue massa semper cursus. Donec quis pretium tellus. In lacinia, augue ut ornare porttitor, diam nunc faucibus purus, et accumsan eros sapien at sem. Sed pulvinar aliquam malesuada. Aliquam erat volutpat. Mauris gravida rutrum lectus at egestas. Fusce tempus elit in tincidunt dictum. Suspendisse dictum egestas sapien, eget ullamcorper metus elementum semper. Vestibulum sem justo, consectetur ac tincidunt et, finibus eget libero.' .PHP_EOL.PHP_EOL .'Deprecated sniffs are still run, but will stop working at some point in the future.'.PHP_EOL.PHP_EOL, @@ -411,9 +411,9 @@ public function testDeprecatedSniffsAreListedAlphabetically() $expected = 'WARNING: The ShowSniffDeprecationsTest standard uses 2 deprecated sniffs'.PHP_EOL; $expected .= '--------------------------------------------------------------------------------'.PHP_EOL; - $expected .= '- Fixtures.Deprecated.WithoutReplacement'.PHP_EOL; + $expected .= '- TestStandard.Deprecated.WithoutReplacement'.PHP_EOL; $expected .= ' This sniff has been deprecated since v3.4.0 and will be removed in v4.0.0.'.PHP_EOL; - $expected .= '- Fixtures.Deprecated.WithReplacement'.PHP_EOL; + $expected .= '- TestStandard.Deprecated.WithReplacement'.PHP_EOL; $expected .= ' This sniff has been deprecated since v3.8.0 and will be removed in v4.0.0.'.PHP_EOL; $expected .= ' Use the Stnd.Category.OtherSniff sniff instead.'.PHP_EOL.PHP_EOL; $expected .= 'Deprecated sniffs are still run, but will stop working at some point in the'.PHP_EOL; @@ -426,12 +426,12 @@ public function testDeprecatedSniffsAreListedAlphabetically() // Verify that the sniffs have been registered to run. $this->assertCount(2, $ruleset->sniffCodes, 'Incorrect number of sniff codes registered'); $this->assertArrayHasKey( - 'Fixtures.Deprecated.WithoutReplacement', + 'TestStandard.Deprecated.WithoutReplacement', $ruleset->sniffCodes, 'WithoutReplacement sniff not registered' ); $this->assertArrayHasKey( - 'Fixtures.Deprecated.WithReplacement', + 'TestStandard.Deprecated.WithReplacement', $ruleset->sniffCodes, 'WithReplacement sniff not registered' ); @@ -484,23 +484,23 @@ public static function dataExceptionIsThrownOnIncorrectlyImplementedInterface() return [ 'getDeprecationVersion() does not return a string' => [ 'standard' => 'ShowSniffDeprecationsInvalidDeprecationVersionTest.xml', - 'exceptionMessage' => 'The Fixtures\Sniffs\DeprecatedInvalid\InvalidDeprecationVersionSniff::getDeprecationVersion() method must return a non-empty string, received double', + 'exceptionMessage' => 'The Fixtures\TestStandard\Sniffs\DeprecatedInvalid\InvalidDeprecationVersionSniff::getDeprecationVersion() method must return a non-empty string, received double', ], 'getRemovalVersion() does not return a string' => [ 'standard' => 'ShowSniffDeprecationsInvalidRemovalVersionTest.xml', - 'exceptionMessage' => 'The Fixtures\Sniffs\DeprecatedInvalid\InvalidRemovalVersionSniff::getRemovalVersion() method must return a non-empty string, received array', + 'exceptionMessage' => 'The Fixtures\TestStandard\Sniffs\DeprecatedInvalid\InvalidRemovalVersionSniff::getRemovalVersion() method must return a non-empty string, received array', ], 'getDeprecationMessage() does not return a string' => [ 'standard' => 'ShowSniffDeprecationsInvalidDeprecationMessageTest.xml', - 'exceptionMessage' => 'The Fixtures\Sniffs\DeprecatedInvalid\InvalidDeprecationMessageSniff::getDeprecationMessage() method must return a string, received object', + 'exceptionMessage' => 'The Fixtures\TestStandard\Sniffs\DeprecatedInvalid\InvalidDeprecationMessageSniff::getDeprecationMessage() method must return a string, received object', ], 'getDeprecationVersion() returns an empty string' => [ 'standard' => 'ShowSniffDeprecationsEmptyDeprecationVersionTest.xml', - 'exceptionMessage' => 'The Fixtures\Sniffs\DeprecatedInvalid\EmptyDeprecationVersionSniff::getDeprecationVersion() method must return a non-empty string, received ""', + 'exceptionMessage' => 'The Fixtures\TestStandard\Sniffs\DeprecatedInvalid\EmptyDeprecationVersionSniff::getDeprecationVersion() method must return a non-empty string, received ""', ], 'getRemovalVersion() returns an empty string' => [ 'standard' => 'ShowSniffDeprecationsEmptyRemovalVersionTest.xml', - 'exceptionMessage' => 'The Fixtures\Sniffs\DeprecatedInvalid\EmptyRemovalVersionSniff::getRemovalVersion() method must return a non-empty string, received ""', + 'exceptionMessage' => 'The Fixtures\TestStandard\Sniffs\DeprecatedInvalid\EmptyRemovalVersionSniff::getRemovalVersion() method must return a non-empty string, received ""', ], ]; diff --git a/tests/Core/Ruleset/ShowSniffDeprecationsTest.xml b/tests/Core/Ruleset/ShowSniffDeprecationsTest.xml index 4665f439b5..38c7e02221 100644 --- a/tests/Core/Ruleset/ShowSniffDeprecationsTest.xml +++ b/tests/Core/Ruleset/ShowSniffDeprecationsTest.xml @@ -1,10 +1,10 @@ - + - - + +