Commit Graph

1 Commits

Author SHA1 Message Date
Sonali dudhia 9aed110ba0 fix: run pest()->afterAll() hooks by flushing statics after tearDownAfterClass() (#1753)
* fix: run `pest()->afterAll()` hooks by flushing statics after `tearDownAfterClass()`

Fixes #1694

Testable::tearDown()'s finally block flushed the afterAll static after
every test via TestCaseMethodFactory::tearDown(), so by the time PHPUnit
called tearDownAfterClass() (which runs after the last test's tearDown())
the hook had already been nulled out. The per-test flush was redundant:
TestCaseMethodFactory::setUp() already flushes statics before re-applying
proxies for the next test. Move the flush into tearDownAfterClass()'s
finally block instead, so it happens after the hook actually runs.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* test: assert `afterAll` hooks run via isolated fixture suite

Runs a fixture suite in a subprocess and asserts both the
`pest()->afterAll()` and file-level `afterAll()` hooks ran once,
in order. Fails on unpatched 5.x (only `afterAll` is recorded).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* style: remove comment from afterAll hook test

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Fix afterAll test style and refresh snapshots

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Punyapal Shah <53343069+MrPunyapal@users.noreply.github.com>
Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
2026-11-14 15:13:25 +05:30