AfterEachTestSubscriber
class AfterEachTestSubscriber implements FinishedSubscriber
Coordinates exactly one global cleanup after every test method.
Prepared tests clean after PHPUnit finishes them. Tests that never become prepared clean before the next test captures global state, or when the test runner finishes if there is no next test.
Properties
| protected bool | $cleanupPending | Whether the current or most recent test still needs global cleanup. |
Methods
Clean up static state after a test finishes.
Handle internal preparation-started coordination for the PHPUnit extension.
Handle internal execution-finished coordination for the PHPUnit extension.
Flush pending cleanup at most once.
Flush all test state after a test finishes.
Flush framework-owned static state.
Flush Fortify state.
Flush Horizon state.
Flush Inertia state.
Flush Nested Set state.
Flush Passkeys state.
Flush Permission state.
Flush Reverb state.
Flush Sanctum state.
Flush Scout state.
Flush Sentry state.
Flush Telescope state.
Flush Testbench state.
Flush Wayfinder state.
Call a static cleanup method when the class is installed.
Details
at line 30
void
notify(Finished $event)
Clean up static state after a test finishes.
at line 38
void
handlePreparationStarted()
Handle internal preparation-started coordination for the PHPUnit extension.
at line 50
void
handleExecutionFinished()
Handle internal execution-finished coordination for the PHPUnit extension.
at line 58
protected void
flushPendingCleanup()
Flush pending cleanup at most once.
at line 71
void
flushStateAfterTest()
Flush all test state after a test finishes.
at line 107
protected void
flushFrameworkState()
Flush framework-owned static state.
at line 342
protected void
flushFortifyState()
Flush Fortify state.
at line 350
protected void
flushHorizonState()
Flush Horizon state.
at line 362
protected void
flushInertiaState()
Flush Inertia state.
at line 374
protected void
flushNestedSetState()
Flush Nested Set state.
at line 382
protected void
flushPasskeysState()
Flush Passkeys state.
at line 392
protected void
flushPermissionState()
Flush Permission state.
at line 402
protected void
flushReverbState()
Flush Reverb state.
at line 411
protected void
flushSanctumState()
Flush Sanctum state.
at line 420
protected void
flushScoutState()
Flush Scout state.
at line 429
protected void
flushSentryState()
Flush Sentry state.
at line 438
protected void
flushTelescopeState()
Flush Telescope state.
at line 448
protected void
flushTestbenchState()
Flush Testbench state.
at line 460
protected void
flushWayfinderState()
Flush Wayfinder state.
at line 468
protected void
callIfExists(string $class, string $method, mixed ...$arguments)
Call a static cleanup method when the class is installed.