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 Data state.
Flush Fortify state.
Flush Horizon state.
Flush Image state.
Flush Inertia state.
Flush JWT state.
Flush Nested Set state.
Flush Passkeys state.
Flush Permission state.
Flush Reverb state.
Flush Saloon 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 343
protected void
flushDataState()
Flush Data state.
at line 354
protected void
flushFortifyState()
Flush Fortify state.
at line 362
protected void
flushHorizonState()
Flush Horizon state.
at line 374
protected void
flushImageState()
Flush Image state.
at line 382
protected void
flushInertiaState()
Flush Inertia state.
at line 394
protected void
flushJwtState()
Flush JWT state.
at line 403
protected void
flushNestedSetState()
Flush Nested Set state.
at line 411
protected void
flushPasskeysState()
Flush Passkeys state.
at line 421
protected void
flushPermissionState()
Flush Permission state.
at line 431
protected void
flushReverbState()
Flush Reverb state.
at line 440
protected void
flushSaloonState()
Flush Saloon state.
at line 451
protected void
flushSanctumState()
Flush Sanctum state.
at line 461
protected void
flushScoutState()
Flush Scout state.
at line 470
protected void
flushSentryState()
Flush Sentry state.
at line 481
protected void
flushTelescopeState()
Flush Telescope state.
at line 492
protected void
flushTestbenchState()
Flush Testbench state.
at line 504
protected void
flushWayfinderState()
Flush Wayfinder state.
at line 512
protected void
callIfExists(string $class, string $method, mixed ...$arguments)
Call a static cleanup method when the class is installed.