mirror of
https://github.com/pestphp/pest.git
synced 2026-12-06 07:42:17 +01:00
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>
This commit is contained in:
@@ -20,7 +20,7 @@ test('parallel', function () use ($run): void {
|
||||
$output = $run('--exclude-group=integration');
|
||||
$output = implode("\n", array_slice(explode("\n", (string) $output), -10));
|
||||
|
||||
$expected = '2 deprecated, 4 warnings, 5 incomplete, 3 notices, 40 todos, 29 skipped, 1627 passed (3587 assertions)';
|
||||
$expected = '2 deprecated, 4 warnings, 5 incomplete, 3 notices, 40 todos, 29 skipped, 1630 passed (3599 assertions)';
|
||||
|
||||
expect($output)
|
||||
->toContain("Tests: {$expected}")
|
||||
|
||||
Reference in New Issue
Block a user