Skip to content

Commit

Permalink
* Update documentation for TestListener deprecation
Browse files Browse the repository at this point in the history
* Document that the Hook interfaces will be removed in PHPUnit 10
  • Loading branch information
sebastianbergmann committed Jan 15, 2022
1 parent c474b4a commit 9b5a2e5
Show file tree
Hide file tree
Showing 14 changed files with 97 additions and 47 deletions.
53 changes: 6 additions & 47 deletions src/Framework/TestListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,73 +12,32 @@
use Throwable;

/**
* @deprecated Use the `TestHook` interfaces instead
* This interface, as well as the associated mechanism for extending PHPUnit,
* will be removed in PHPUnit 10. There is no alternative available in this
* version of PHPUnit.
*
* @deprecated
* @see https://github.com/sebastianbergmann/phpunit/issues/4676
*/
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;
}
7 changes: 7 additions & 0 deletions src/Runner/Hook/AfterIncompleteTestHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
*/
namespace PHPUnit\Runner;

/**
* This interface, as well as the associated mechanism for extending PHPUnit,
* will be removed in PHPUnit 10. There is no alternative available in this
* version of PHPUnit.
*
* @see https://github.com/sebastianbergmann/phpunit/issues/4676
*/
interface AfterIncompleteTestHook extends TestHook
{
public function executeAfterIncompleteTest(string $test, string $message, float $time): void;
Expand Down
7 changes: 7 additions & 0 deletions src/Runner/Hook/AfterLastTestHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
*/
namespace PHPUnit\Runner;

/**
* This interface, as well as the associated mechanism for extending PHPUnit,
* will be removed in PHPUnit 10. There is no alternative available in this
* version of PHPUnit.
*
* @see https://github.com/sebastianbergmann/phpunit/issues/4676
*/
interface AfterLastTestHook extends Hook
{
public function executeAfterLastTest(): void;
Expand Down
7 changes: 7 additions & 0 deletions src/Runner/Hook/AfterRiskyTestHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
*/
namespace PHPUnit\Runner;

/**
* This interface, as well as the associated mechanism for extending PHPUnit,
* will be removed in PHPUnit 10. There is no alternative available in this
* version of PHPUnit.
*
* @see https://github.com/sebastianbergmann/phpunit/issues/4676
*/
interface AfterRiskyTestHook extends TestHook
{
public function executeAfterRiskyTest(string $test, string $message, float $time): void;
Expand Down
7 changes: 7 additions & 0 deletions src/Runner/Hook/AfterSkippedTestHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
*/
namespace PHPUnit\Runner;

/**
* This interface, as well as the associated mechanism for extending PHPUnit,
* will be removed in PHPUnit 10. There is no alternative available in this
* version of PHPUnit.
*
* @see https://github.com/sebastianbergmann/phpunit/issues/4676
*/
interface AfterSkippedTestHook extends TestHook
{
public function executeAfterSkippedTest(string $test, string $message, float $time): void;
Expand Down
7 changes: 7 additions & 0 deletions src/Runner/Hook/AfterSuccessfulTestHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
*/
namespace PHPUnit\Runner;

/**
* This interface, as well as the associated mechanism for extending PHPUnit,
* will be removed in PHPUnit 10. There is no alternative available in this
* version of PHPUnit.
*
* @see https://github.com/sebastianbergmann/phpunit/issues/4676
*/
interface AfterSuccessfulTestHook extends TestHook
{
public function executeAfterSuccessfulTest(string $test, float $time): void;
Expand Down
7 changes: 7 additions & 0 deletions src/Runner/Hook/AfterTestErrorHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
*/
namespace PHPUnit\Runner;

/**
* This interface, as well as the associated mechanism for extending PHPUnit,
* will be removed in PHPUnit 10. There is no alternative available in this
* version of PHPUnit.
*
* @see https://github.com/sebastianbergmann/phpunit/issues/4676
*/
interface AfterTestErrorHook extends TestHook
{
public function executeAfterTestError(string $test, string $message, float $time): void;
Expand Down
7 changes: 7 additions & 0 deletions src/Runner/Hook/AfterTestFailureHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
*/
namespace PHPUnit\Runner;

/**
* This interface, as well as the associated mechanism for extending PHPUnit,
* will be removed in PHPUnit 10. There is no alternative available in this
* version of PHPUnit.
*
* @see https://github.com/sebastianbergmann/phpunit/issues/4676
*/
interface AfterTestFailureHook extends TestHook
{
public function executeAfterTestFailure(string $test, string $message, float $time): void;
Expand Down
7 changes: 7 additions & 0 deletions src/Runner/Hook/AfterTestHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
*/
namespace PHPUnit\Runner;

/**
* This interface, as well as the associated mechanism for extending PHPUnit,
* will be removed in PHPUnit 10. There is no alternative available in this
* version of PHPUnit.
*
* @see https://github.com/sebastianbergmann/phpunit/issues/4676
*/
interface AfterTestHook extends TestHook
{
/**
Expand Down
7 changes: 7 additions & 0 deletions src/Runner/Hook/AfterTestWarningHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
*/
namespace PHPUnit\Runner;

/**
* This interface, as well as the associated mechanism for extending PHPUnit,
* will be removed in PHPUnit 10. There is no alternative available in this
* version of PHPUnit.
*
* @see https://github.com/sebastianbergmann/phpunit/issues/4676
*/
interface AfterTestWarningHook extends TestHook
{
public function executeAfterTestWarning(string $test, string $message, float $time): void;
Expand Down
7 changes: 7 additions & 0 deletions src/Runner/Hook/BeforeFirstTestHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
*/
namespace PHPUnit\Runner;

/**
* This interface, as well as the associated mechanism for extending PHPUnit,
* will be removed in PHPUnit 10. There is no alternative available in this
* version of PHPUnit.
*
* @see https://github.com/sebastianbergmann/phpunit/issues/4676
*/
interface BeforeFirstTestHook extends Hook
{
public function executeBeforeFirstTest(): void;
Expand Down
7 changes: 7 additions & 0 deletions src/Runner/Hook/BeforeTestHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
*/
namespace PHPUnit\Runner;

/**
* This interface, as well as the associated mechanism for extending PHPUnit,
* will be removed in PHPUnit 10. There is no alternative available in this
* version of PHPUnit.
*
* @see https://github.com/sebastianbergmann/phpunit/issues/4676
*/
interface BeforeTestHook extends TestHook
{
public function executeBeforeTest(string $test): void;
Expand Down
7 changes: 7 additions & 0 deletions src/Runner/Hook/Hook.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
*/
namespace PHPUnit\Runner;

/**
* This interface, as well as the associated mechanism for extending PHPUnit,
* will be removed in PHPUnit 10. There is no alternative available in this
* version of PHPUnit.
*
* @see https://github.com/sebastianbergmann/phpunit/issues/4676
*/
interface Hook
{
}
7 changes: 7 additions & 0 deletions src/Runner/Hook/TestHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
*/
namespace PHPUnit\Runner;

/**
* This interface, as well as the associated mechanism for extending PHPUnit,
* will be removed in PHPUnit 10. There is no alternative available in this
* version of PHPUnit.
*
* @see https://github.com/sebastianbergmann/phpunit/issues/4676
*/
interface TestHook extends Hook
{
}

0 comments on commit 9b5a2e5

Please sign in to comment.