Skip to content

Commit

Permalink
Tests: rename base class and make abstract
Browse files Browse the repository at this point in the history
The `BaseSniffTest` class, which is used as a basis for all test classes, should by rights be an `abstract` class as it doesn't contain any tests itself.

However, using the `Test` suffix for abstract test case classes is deprecated since PHPUnit 9.6.

Even though this wasn't causing us any problems so far (as the class wasn't `abstract`), let's tidy this up to future-proof PHPUnit cross-version compatibility.

So, in this commit:
* The `BaseSniffTest` class is renamed to `BaseSniffTestCase`, including updating the file name to match.
* All test classes which `extend` the class have been updated to now extend the `BaseSniffTestCase`.

Ref: sebastianbergmann/phpunit#5132
  • Loading branch information
jrfnl committed Jul 29, 2023
1 parent 3a363eb commit e6c9d9d
Show file tree
Hide file tree
Showing 157 changed files with 312 additions and 312 deletions.
4 changes: 2 additions & 2 deletions PHPCompatibility/Tests/Attributes/NewAttributesUnitTest.php
Expand Up @@ -10,7 +10,7 @@

namespace PHPCompatibility\Tests\Attributes;

use PHPCompatibility\Tests\BaseSniffTest;
use PHPCompatibility\Tests\BaseSniffTestCase;

/**
* Test the NewAttributes sniff.
Expand All @@ -22,7 +22,7 @@
*
* @since 10.0.0
*/
class NewAttributesUnitTest extends BaseSniffTest
class NewAttributesUnitTest extends BaseSniffTestCase
{

/**
Expand Down
Expand Up @@ -30,7 +30,7 @@
* @since 9.0.0 Dropped support for PHP_CodeSniffer 1.x.
* @since 10.0.0 Updated for preliminary support of PHP_CodeSniffer 4 and dropped support for PHPCS 2.x.
*/
class BaseSniffTest extends TestCase
abstract class BaseSniffTestCase extends TestCase
{
use AssertStringContains;

Expand Down
Expand Up @@ -10,7 +10,7 @@

namespace PHPCompatibility\Tests\Classes;

use PHPCompatibility\Tests\BaseSniffTest;
use PHPCompatibility\Tests\BaseSniffTestCase;

/**
* Test the ForbiddenExtendingFinalPHPClass sniff.
Expand All @@ -22,7 +22,7 @@
*
* @since 10.0.0
*/
class ForbiddenExtendingFinalPHPClassUnitTest extends BaseSniffTest
class ForbiddenExtendingFinalPHPClassUnitTest extends BaseSniffTestCase
{

/**
Expand Down
Expand Up @@ -10,7 +10,7 @@

namespace PHPCompatibility\Tests\Classes;

use PHPCompatibility\Tests\BaseSniffTest;
use PHPCompatibility\Tests\BaseSniffTestCase;

/**
* Test the NewAnonymousClasses sniff.
Expand All @@ -22,7 +22,7 @@
*
* @since 7.0.0
*/
class NewAnonymousClassesUnitTest extends BaseSniffTest
class NewAnonymousClassesUnitTest extends BaseSniffTestCase
{

/**
Expand Down
4 changes: 2 additions & 2 deletions PHPCompatibility/Tests/Classes/NewClassesUnitTest.php
Expand Up @@ -10,7 +10,7 @@

namespace PHPCompatibility\Tests\Classes;

use PHPCompatibility\Tests\BaseSniffTest;
use PHPCompatibility\Tests\BaseSniffTestCase;

/**
* Test the NewClasses sniff.
Expand All @@ -22,7 +22,7 @@
*
* @since 5.5
*/
class NewClassesUnitTest extends BaseSniffTest
class NewClassesUnitTest extends BaseSniffTestCase
{

/**
Expand Down
4 changes: 2 additions & 2 deletions PHPCompatibility/Tests/Classes/NewConstVisibilityUnitTest.php
Expand Up @@ -10,7 +10,7 @@

namespace PHPCompatibility\Tests\Classes;

use PHPCompatibility\Tests\BaseSniffTest;
use PHPCompatibility\Tests\BaseSniffTestCase;

/**
* Test the NewConstVisibility sniff.
Expand All @@ -22,7 +22,7 @@
*
* @since 7.0.7
*/
class NewConstVisibilityUnitTest extends BaseSniffTest
class NewConstVisibilityUnitTest extends BaseSniffTestCase
{

/**
Expand Down
Expand Up @@ -10,7 +10,7 @@

namespace PHPCompatibility\Tests\Classes;

use PHPCompatibility\Tests\BaseSniffTest;
use PHPCompatibility\Tests\BaseSniffTestCase;

/**
* Test the NewConstructorPropertyPromotion sniff.
Expand All @@ -22,7 +22,7 @@
*
* @since 10.0.0
*/
final class NewConstructorPropertyPromotionUnitTest extends BaseSniffTest
final class NewConstructorPropertyPromotionUnitTest extends BaseSniffTestCase
{

/**
Expand Down
4 changes: 2 additions & 2 deletions PHPCompatibility/Tests/Classes/NewFinalConstantsUnitTest.php
Expand Up @@ -10,7 +10,7 @@

namespace PHPCompatibility\Tests\Classes;

use PHPCompatibility\Tests\BaseSniffTest;
use PHPCompatibility\Tests\BaseSniffTestCase;

/**
* Test the NewFinalConstants sniff.
Expand All @@ -22,7 +22,7 @@
*
* @since 10.0.0
*/
class NewFinalConstantsUnitTest extends BaseSniffTest
class NewFinalConstantsUnitTest extends BaseSniffTestCase
{

/**
Expand Down
Expand Up @@ -10,7 +10,7 @@

namespace PHPCompatibility\Tests\Classes;

use PHPCompatibility\Tests\BaseSniffTest;
use PHPCompatibility\Tests\BaseSniffTestCase;

/**
* Test the NewLateStaticBinding sniff.
Expand All @@ -22,7 +22,7 @@
*
* @since 7.0.3
*/
class NewLateStaticBindingUnitTest extends BaseSniffTest
class NewLateStaticBindingUnitTest extends BaseSniffTestCase
{

/**
Expand Down
4 changes: 2 additions & 2 deletions PHPCompatibility/Tests/Classes/NewReadonlyClassesUnitTest.php
Expand Up @@ -10,7 +10,7 @@

namespace PHPCompatibility\Tests\Classes;

use PHPCompatibility\Tests\BaseSniffTest;
use PHPCompatibility\Tests\BaseSniffTestCase;

/**
* Test the NewReadonlyClasses sniff.
Expand All @@ -22,7 +22,7 @@
*
* @since 10.0.0
*/
final class NewReadonlyClassesUnitTest extends BaseSniffTest
final class NewReadonlyClassesUnitTest extends BaseSniffTestCase
{

/**
Expand Down
Expand Up @@ -10,7 +10,7 @@

namespace PHPCompatibility\Tests\Classes;

use PHPCompatibility\Tests\BaseSniffTest;
use PHPCompatibility\Tests\BaseSniffTestCase;

/**
* Test the NewReadonlyProperties sniff.
Expand All @@ -22,7 +22,7 @@
*
* @since 10.0.0
*/
final class NewReadonlyPropertiesUnitTest extends BaseSniffTest
final class NewReadonlyPropertiesUnitTest extends BaseSniffTestCase
{

/**
Expand Down
4 changes: 2 additions & 2 deletions PHPCompatibility/Tests/Classes/NewTypedPropertiesUnitTest.php
Expand Up @@ -10,7 +10,7 @@

namespace PHPCompatibility\Tests\Classes;

use PHPCompatibility\Tests\BaseSniffTest;
use PHPCompatibility\Tests\BaseSniffTestCase;

/**
* Test the NewTypedProperties sniff.
Expand All @@ -22,7 +22,7 @@
*
* @since 9.2.0
*/
class NewTypedPropertiesUnitTest extends BaseSniffTest
class NewTypedPropertiesUnitTest extends BaseSniffTestCase
{

/**
Expand Down
4 changes: 2 additions & 2 deletions PHPCompatibility/Tests/Classes/RemovedClassesUnitTest.php
Expand Up @@ -10,7 +10,7 @@

namespace PHPCompatibility\Tests\Classes;

use PHPCompatibility\Tests\BaseSniffTest;
use PHPCompatibility\Tests\BaseSniffTestCase;

/**
* Test the RemovedClasses sniff.
Expand All @@ -22,7 +22,7 @@
*
* @since 10.0.0
*/
class RemovedClassesUnitTest extends BaseSniffTest
class RemovedClassesUnitTest extends BaseSniffTestCase
{

/**
Expand Down
Expand Up @@ -10,7 +10,7 @@

namespace PHPCompatibility\Tests\Classes;

use PHPCompatibility\Tests\BaseSniffTest;
use PHPCompatibility\Tests\BaseSniffTestCase;

/**
* Test the RemovedOrphanedParent sniff.
Expand All @@ -22,7 +22,7 @@
*
* @since 9.2.0
*/
class RemovedOrphanedParentUnitTest extends BaseSniffTest
class RemovedOrphanedParentUnitTest extends BaseSniffTestCase
{

/**
Expand Down
Expand Up @@ -10,7 +10,7 @@

namespace PHPCompatibility\Tests\Constants;

use PHPCompatibility\Tests\BaseSniffTest;
use PHPCompatibility\Tests\BaseSniffTestCase;

/**
* Test the NewConstantsInTraits sniff.
Expand All @@ -22,7 +22,7 @@
*
* @since 10.0.0
*/
final class NewConstantsInTraitsUnitTest extends BaseSniffTest
final class NewConstantsInTraitsUnitTest extends BaseSniffTestCase
{

/**
Expand Down
4 changes: 2 additions & 2 deletions PHPCompatibility/Tests/Constants/NewConstantsUnitTest.php
Expand Up @@ -10,7 +10,7 @@

namespace PHPCompatibility\Tests\Constants;

use PHPCompatibility\Tests\BaseSniffTest;
use PHPCompatibility\Tests\BaseSniffTestCase;

/**
* Test the NewConstants sniff.
Expand All @@ -22,7 +22,7 @@
*
* @since 8.1.0
*/
class NewConstantsUnitTest extends BaseSniffTest
class NewConstantsUnitTest extends BaseSniffTestCase
{

/**
Expand Down
Expand Up @@ -10,7 +10,7 @@

namespace PHPCompatibility\Tests\Constants;

use PHPCompatibility\Tests\BaseSniffTest;
use PHPCompatibility\Tests\BaseSniffTestCase;

/**
* Test the NewMagicClassConstant sniff.
Expand All @@ -22,7 +22,7 @@
*
* @since 7.1.4
*/
class NewMagicClassConstantUnitTest extends BaseSniffTest
class NewMagicClassConstantUnitTest extends BaseSniffTestCase
{

/**
Expand Down
4 changes: 2 additions & 2 deletions PHPCompatibility/Tests/Constants/RemovedConstantsUnitTest.php
Expand Up @@ -10,7 +10,7 @@

namespace PHPCompatibility\Tests\Constants;

use PHPCompatibility\Tests\BaseSniffTest;
use PHPCompatibility\Tests\BaseSniffTestCase;

/**
* Test the RemovedConstants sniff.
Expand All @@ -22,7 +22,7 @@
*
* @since 8.1.0
*/
class RemovedConstantsUnitTest extends BaseSniffTest
class RemovedConstantsUnitTest extends BaseSniffTestCase
{

/**
Expand Down
Expand Up @@ -10,7 +10,7 @@

namespace PHPCompatibility\Tests\ControlStructures;

use PHPCompatibility\Tests\BaseSniffTest;
use PHPCompatibility\Tests\BaseSniffTestCase;

/**
* Test the DiscouragedSwitchContinue sniff.
Expand All @@ -22,7 +22,7 @@
*
* @since 8.2.0
*/
class DiscouragedSwitchContinueUnitTest extends BaseSniffTest
class DiscouragedSwitchContinueUnitTest extends BaseSniffTestCase
{

/**
Expand Down
Expand Up @@ -10,7 +10,7 @@

namespace PHPCompatibility\Tests\ControlStructures;

use PHPCompatibility\Tests\BaseSniffTest;
use PHPCompatibility\Tests\BaseSniffTestCase;

/**
* Test the ForbiddenBreakContinueOutsideLoop sniff.
Expand All @@ -22,7 +22,7 @@
*
* @since 7.0.7
*/
class ForbiddenBreakContinueOutsideLoopUnitTest extends BaseSniffTest
class ForbiddenBreakContinueOutsideLoopUnitTest extends BaseSniffTestCase
{

/**
Expand Down
Expand Up @@ -10,7 +10,7 @@

namespace PHPCompatibility\Tests\ControlStructures;

use PHPCompatibility\Tests\BaseSniffTest;
use PHPCompatibility\Tests\BaseSniffTestCase;

/**
* Test the ForbiddenBreakContinueVariableArguments sniff.
Expand All @@ -22,7 +22,7 @@
*
* @since 5.5
*/
class ForbiddenBreakContinueVariableArgumentsUnitTest extends BaseSniffTest
class ForbiddenBreakContinueVariableArgumentsUnitTest extends BaseSniffTestCase
{

/**
Expand Down
Expand Up @@ -10,7 +10,7 @@

namespace PHPCompatibility\Tests\ControlStructures;

use PHPCompatibility\Tests\BaseSniffTest;
use PHPCompatibility\Tests\BaseSniffTestCase;

/**
* Test the ForbiddenSwitchWithMultipleDefaultBlocks sniff.
Expand All @@ -22,7 +22,7 @@
*
* @since 7.0.0
*/
class ForbiddenSwitchWithMultipleDefaultBlocksUnitTest extends BaseSniffTest
class ForbiddenSwitchWithMultipleDefaultBlocksUnitTest extends BaseSniffTestCase
{

/**
Expand Down

0 comments on commit e6c9d9d

Please sign in to comment.