Skip to content

Commit

Permalink
Closes #5132
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Jan 14, 2023
1 parent aa872df commit bda4aed
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ChangeLog-9.6.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ All notable changes of the PHPUnit 9.6 release series are documented in this fil

## [9.6.0] - 2023-02-03

### Changed

* [#5132](https://github.com/sebastianbergmann/phpunit/issues/5132): Deprecate `Test` suffix for abstract test case classes

[9.6.0]: https://github.com/sebastianbergmann/phpunit/compare/9.5...9.6
9 changes: 9 additions & 0 deletions src/Framework/TestSuite.php
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,15 @@ public function addTestFile(string $filename): void
continue;
}

if ($class->isAbstract() && $class->isSubclassOf(TestCase::class)) {
$this->addWarning(
sprintf(
'Abstract test case classes with "Test" suffix are deprecated (%s)',
$class->getName()
)
);
}

if (!$class->isAbstract()) {
if ($class->hasMethod(BaseTestRunner::SUITE_METHODNAME)) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ PHPUnit\TextUI\Command::main();
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.

Warning: Abstract test case classes with "Test" suffix are deprecated (PHPUnit\TestFixture\AbstractTest)

. 1 / 1 (100%)

Time: %s, Memory: %s
Expand Down
1 change: 1 addition & 0 deletions tests/end-to-end/generic/test-suffix-multiple.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Warning: Test case class not matching filename is deprecated
Warning: Test case class not matching filename is deprecated
in %sConcreteTest.my.php
Class name was 'ConcreteWithMyCustomExtensionTest', expected 'ConcreteTest'
Warning: Abstract test case classes with "Test" suffix are deprecated (PHPUnit\TestFixture\AbstractTest)

..... 5 / 5 (100%)

Expand Down

0 comments on commit bda4aed

Please sign in to comment.