diff --git a/ChangeLog-10.0.md b/ChangeLog-10.0.md index fe23df8065c..42d582889a6 100644 --- a/ChangeLog-10.0.md +++ b/ChangeLog-10.0.md @@ -10,6 +10,7 @@ All notable changes of the PHPUnit 10.0 release series are documented in this fi ### Removed +* [#3389](https://github.com/sebastianbergmann/phpunit/issues/3389): Removed `PHPUnit\Framework\TestListener` and `PHPUnit\Framework\TestListenerDefaultImplementation` * [#3631](https://github.com/sebastianbergmann/phpunit/issues/3631): Remove support for `"ClassName<*>"` as values for `@covers` and `@uses` annotations * [#3769](https://github.com/sebastianbergmann/phpunit/issues/3769): Remove `MockBuilder::setMethods()` and `MockBuilder::setMethodsExcept()` * [#3777](https://github.com/sebastianbergmann/phpunit/issues/3777): Remove `PHPUnit\Framework\Error\*` classes diff --git a/src/Framework/TestListener.php b/src/Framework/TestListener.php index aaf5e7cd978..4a5e8eeb2b7 100644 --- a/src/Framework/TestListener.php +++ b/src/Framework/TestListener.php @@ -12,74 +12,27 @@ use Throwable; /** - * @deprecated Use the `TestHook` interfaces instead - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * @internal */ interface TestListener { - /** - * An error occurred. - * - * @deprecated Use `AfterTestErrorHook::executeAfterTestError` instead - */ public function addError(Test $test, Throwable $t, float $time): void; - /** - * A warning occurred. - * - * @deprecated Use `AfterTestWarningHook::executeAfterTestWarning` instead - */ public function addWarning(Test $test, Warning $e, float $time): void; - /** - * A failure occurred. - * - * @deprecated Use `AfterTestFailureHook::executeAfterTestFailure` instead - */ public function addFailure(Test $test, AssertionFailedError $e, float $time): void; - /** - * Incomplete test. - * - * @deprecated Use `AfterIncompleteTestHook::executeAfterIncompleteTest` instead - */ public function addIncompleteTest(Test $test, Throwable $t, float $time): void; - /** - * Risky test. - * - * @deprecated Use `AfterRiskyTestHook::executeAfterRiskyTest` instead - */ public function addRiskyTest(Test $test, Throwable $t, float $time): void; - /** - * Skipped test. - * - * @deprecated Use `AfterSkippedTestHook::executeAfterSkippedTest` instead - */ public function addSkippedTest(Test $test, Throwable $t, float $time): void; - /** - * A test suite started. - */ public function startTestSuite(TestSuite $suite): void; - /** - * A test suite ended. - */ public function endTestSuite(TestSuite $suite): void; - /** - * A test started. - * - * @deprecated Use `BeforeTestHook::executeBeforeTest` instead - */ public function startTest(Test $test): void; - /** - * A test ended. - * - * @deprecated Use `AfterTestHook::executeAfterTest` instead - */ public function endTest(Test $test, float $time): void; } diff --git a/tests/_files/MyTestListener.php b/tests/_files/MyTestListener.php deleted file mode 100644 index a95b495c2f6..00000000000 --- a/tests/_files/MyTestListener.php +++ /dev/null @@ -1,124 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TestFixture; - -use PHPUnit\Framework\AssertionFailedError; -use PHPUnit\Framework\Test; -use PHPUnit\Framework\TestListener; -use PHPUnit\Framework\TestSuite; -use PHPUnit\Framework\Warning; -use Throwable; - -final class MyTestListener implements TestListener -{ - private $endCount = 0; - - private $errorCount = 0; - - private $failureCount = 0; - - private $warningCount = 0; - - private $notImplementedCount = 0; - - private $riskyCount = 0; - - private $skippedCount = 0; - - private $startCount = 0; - - public function addError(Test $test, Throwable $t, float $time): void - { - $this->errorCount++; - } - - public function addWarning(Test $test, Warning $e, float $time): void - { - $this->warningCount++; - } - - public function addFailure(Test $test, AssertionFailedError $e, float $time): void - { - $this->failureCount++; - } - - public function addIncompleteTest(Test $test, Throwable $t, float $time): void - { - $this->notImplementedCount++; - } - - public function addRiskyTest(Test $test, Throwable $t, float $time): void - { - $this->riskyCount++; - } - - public function addSkippedTest(Test $test, Throwable $t, float $time): void - { - $this->skippedCount++; - } - - public function startTestSuite(TestSuite $suite): void - { - } - - public function endTestSuite(TestSuite $suite): void - { - } - - public function startTest(Test $test): void - { - $this->startCount++; - } - - public function endTest(Test $test, float $time): void - { - $this->endCount++; - } - - public function endCount(): int - { - return $this->endCount; - } - - public function errorCount(): int - { - return $this->errorCount; - } - - public function failureCount(): int - { - return $this->failureCount; - } - - public function warningCount(): int - { - return $this->warningCount; - } - - public function notImplementedCount(): int - { - return $this->notImplementedCount; - } - - public function riskyCount(): int - { - return $this->riskyCount; - } - - public function skippedCount(): int - { - return $this->skippedCount; - } - - public function startCount(): int - { - return $this->startCount; - } -} diff --git a/tests/unit/Framework/TestListenerTest.php b/tests/unit/Framework/TestListenerTest.php deleted file mode 100644 index 8f5aad0c7a0..00000000000 --- a/tests/unit/Framework/TestListenerTest.php +++ /dev/null @@ -1,66 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework; - -use PHPUnit\TestFixture\Failure; -use PHPUnit\TestFixture\MyTestListener; -use PHPUnit\TestFixture\Success; -use PHPUnit\TestFixture\TestError; - -/** - * @small - */ -final class TestListenerTest extends TestCase -{ - /** - * @var TestResult - */ - private $result; - - /** - * @var MyTestListener - */ - private $listener; - - protected function setUp(): void - { - $this->result = new TestResult; - $this->listener = new MyTestListener; - - $this->result->addListener($this->listener); - } - - public function testError(): void - { - $test = new TestError; - $test->run($this->result); - - $this->assertEquals(1, $this->listener->errorCount()); - $this->assertEquals(1, $this->listener->endCount()); - } - - public function testFailure(): void - { - $test = new Failure; - $test->run($this->result); - - $this->assertEquals(1, $this->listener->failureCount()); - $this->assertEquals(1, $this->listener->endCount()); - } - - public function testStartStop(): void - { - $test = new Success; - $test->run($this->result); - - $this->assertEquals(1, $this->listener->startCount()); - $this->assertEquals(1, $this->listener->endCount()); - } -}