Skip to content

fix: preserve the global afterAll hook until class teardown - #1743

Closed
lazerg wants to merge 1 commit into
pestphp:4.xfrom
lazerg:fix/issue-1694-afterall-not-called
Closed

fix: preserve the global afterAll hook until class teardown#1743
lazerg wants to merge 1 commit into
pestphp:4.xfrom
lazerg:fix/issue-1694-afterall-not-called

Conversation

@lazerg

@lazerg lazerg commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

What:

  • Bug Fix

Description:

A global afterAll() hook (registered via uses()/pest()) never runs, while beforeAll, beforeEach and afterEach work. beforeAll is consumed in setUpBeforeClass before any test runs, but the last test's tearDown flushes the static $__afterAll before tearDownAfterClass reads it, so the global afterAll silently no-ops. This captures the hook in setUpBeforeClass while it's still set and uses that copy at teardown.

Related:

Closes #1694

@lazerg

lazerg commented Aug 22, 2026

Copy link
Copy Markdown
Contributor Author

Hi @nunomaduro, just checking back on this one. It's been about three weeks since I flagged it. The global afterAll hook does not run right now. Let me know if you need anything from me to move it forward.

@lazerg lazerg closed this Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: AfterAll() hook not being called

1 participant