AfterEachTestCleanup
class AfterEachTestCleanup
Process-local after-each cleanup callbacks for apps and packages.
This class intentionally does not expose flushState() and should not be
added to AfterEachTestSubscriber; callbacks are suite-level registrations
that must persist for the PHPUnit worker lifetime.
Properties
| static protected array<string, Closure(): void> | $callbacks | The registered after-each cleanup callbacks. |
Methods
Register a callback to flush test state after every test.
Run registered callbacks.
Forget a registered callback by name.
Forget all registered callbacks.
Details
at line 32
static void
flushUsing(string $name, callable $callback)
Register a callback to flush test state after every test.
Boot or tests only. The callback persists in static state for the PHPUnit worker lifetime and runs after every subsequent test.
at line 42
static void
runCallbacks()
Run registered callbacks.
at line 67
static void
forget(string $name)
Forget a registered callback by name.
Boot or tests only. This removes one process-local cleanup registration from the current PHPUnit worker.
at line 79
static void
forgetCallbacks()
Forget all registered callbacks.
Boot or tests only. This removes process-local cleanup registrations for the current PHPUnit worker, including callbacks discovered from app and package metadata.