Commit Graph

8 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
Nuno Maduro fd4f161edd release: v2.24.1 2023-10-26 11:02:35 -04:00
Nuno Maduro cf47b45262 feat: basic PHPUnit 10 support 2021-10-24 01:03:18 +01:00
jordanbrauer d217503a6a test: use consistent test descriptors 2021-07-21 20:47:48 -05:00
jordanbrauer 79ff332afe test: global "all" hooks must only run once (#351)
in other words, they can only run once per file
2021-07-21 20:32:39 -05:00
jordanbrauer 584a7ac8a5 test: add cases for global before/after all hooks 2021-04-07 10:52:49 -05:00
jordanbrauer 54f9397f47 style: address stan + lint issues 2021-04-06 19:32:49 -05:00
jordanbrauer 53333b56ab test: adding tests for beforeEach and afterEach + empty tests for *All 2021-04-06 19:26:42 -05:00