Skip to content

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

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

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

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 Jul 1, 2026

Copy link
Copy Markdown
Author

@nunomaduro bumping this — a couple of people have hit the same afterAll issue in the thread.

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