Repository navigation
Repair wp/6.0 branch Actions: use PHPUnit Polyfills' set_up()/tear_down() fixture methods - #383
Closed
desrosj wants to merge 1 commit into
Conversation
desrosj
added this pull request to stack #329
September 17, 2026 03:49
desrosj
force-pushed
the
fix-actions-6.0/fix-setup-teardown-polyfills
branch
from
September 18, 2026 19:27
d51b5c7 to
cff18f8
Compare
desrosj
removed this pull request from stack #329
September 21, 2026 18:46
desrosj
changed the base branch from
fix-actions-6.0/fix-phpunit-execution
to
wp/6.0
September 21, 2026 18:47
desrosj
force-pushed
the
fix-actions-6.0/fix-setup-teardown-polyfills
branch
from
September 21, 2026 18:52
cff18f8 to
132d88d
Compare
desrosj
changed the base branch from
wp/6.0
to
fix-actions-6.0/fix-phpunit-execution
September 21, 2026 18:54
desrosj
added this pull request to stack #404
September 21, 2026 18:54
desrosj
removed this pull request from stack #404
September 21, 2026 19:38
desrosj
changed the base branch from
fix-actions-6.0/fix-phpunit-execution
to
wp/6.0
September 21, 2026 19:39
desrosj
force-pushed
the
fix-actions-6.0/fix-setup-teardown-polyfills
branch
from
September 21, 2026 19:42
132d88d to
3b603e9
Compare
desrosj
changed the base branch from
wp/6.0
to
fix-actions-6.0/fix-phpunit-execution
September 21, 2026 19:45
desrosj
added this pull request to stack #418
September 21, 2026 19:45
desrosj
removed this pull request from stack #418
September 21, 2026 21:52
desrosj
changed the base branch from
fix-actions-6.0/fix-phpunit-execution
to
wp/6.0
September 21, 2026 21:53
desrosj
force-pushed
the
fix-actions-6.0/fix-setup-teardown-polyfills
branch
from
September 21, 2026 21:55
3b603e9 to
e395188
Compare
desrosj
changed the base branch from
wp/6.0
to
fix-actions-6.0/fix-phpunit-execution
September 21, 2026 21:56
desrosj
added this pull request to stack #429
September 21, 2026 21:57
desrosj
removed this pull request from stack #429
September 21, 2026 23:49
desrosj
changed the base branch from
fix-actions-6.0/fix-phpunit-execution
to
wp/6.0
September 21, 2026 23:50
desrosj
changed the base branch from
wp/6.0
to
fix-actions-6.0/fix-phpunit-execution
September 21, 2026 23:52
desrosj
added this pull request to stack #438
September 21, 2026 23:52
desrosj
removed this pull request from stack #438
September 22, 2026 15:57
desrosj
changed the base branch from
fix-actions-6.0/fix-phpunit-execution
to
wp/6.0
September 22, 2026 15:58
desrosj
force-pushed
the
fix-actions-6.0/fix-setup-teardown-polyfills
branch
from
September 22, 2026 16:00
e395188 to
26c5f0b
Compare
desrosj
changed the base branch from
wp/6.0
to
fix-actions-6.0/fix-phpunit-execution
September 22, 2026 16:01
desrosj
added this pull request to stack #502
September 23, 2026 21:30
desrosj
force-pushed
the
fix-actions-6.0/fix-setup-teardown-polyfills
branch
from
September 24, 2026 00:38
c97d253 to
fd9658c
Compare
desrosj
force-pushed
the
fix-actions-6.0/fix-setup-teardown-polyfills
branch
from
September 24, 2026 02:44
fd9658c to
4a13744
Compare
desrosj
removed this pull request from stack #502
September 24, 2026 18:18
desrosj
changed the base branch from
fix-actions-6.0/fix-phpunit-execution
to
wp/6.0
September 24, 2026 18:18
desrosj
force-pushed
the
fix-actions-6.0/fix-setup-teardown-polyfills
branch
from
September 24, 2026 18:18
4a13744 to
0ce719f
Compare
desrosj
changed the base branch from
wp/6.0
to
fix-actions-6.0/fix-phpunit-execution
September 24, 2026 18:19
desrosj
added this pull request to stack #522
September 24, 2026 18:19
desrosj
removed this pull request from stack #522
September 28, 2026 14:36
desrosj
changed the base branch from
fix-actions-6.0/fix-phpunit-execution
to
wp/6.0
September 28, 2026 14:37
desrosj
force-pushed
the
fix-actions-6.0/fix-setup-teardown-polyfills
branch
from
September 28, 2026 14:37
0ce719f to
95398c7
Compare
desrosj
changed the base branch from
wp/6.0
to
fix-actions-6.0/fix-phpunit-execution
September 28, 2026 14:38
desrosj
added this pull request to stack #543
September 28, 2026 14:38
desrosj
removed this pull request from stack #543
September 28, 2026 19:11
desrosj
changed the base branch from
fix-actions-6.0/fix-phpunit-execution
to
wp/6.0
September 28, 2026 19:11
desrosj
force-pushed
the
fix-actions-6.0/fix-setup-teardown-polyfills
branch
from
September 28, 2026 19:12
95398c7 to
f3a8908
Compare
desrosj
changed the base branch from
wp/6.0
to
fix-actions-6.0/fix-phpunit-execution
September 28, 2026 19:12
desrosj
added this pull request to stack #569
September 28, 2026 19:12
desrosj
removed this pull request from stack #569
October 5, 2026 18:42
desrosj
added this pull request to stack #605
October 5, 2026 18:43
desrosj
force-pushed
the
fix-actions-6.0/fix-setup-teardown-polyfills
branch
from
October 5, 2026 20:55
f3a8908 to
37889bf
Compare
desrosj
removed this pull request from stack #605
October 5, 2026 20:55
desrosj
added this pull request to stack #618
October 5, 2026 20:56
…lasses.
wp-phpunit/wp-phpunit 6.0.14's WP_UnitTestCase now chains through
yoast/phpunit-polyfills, whose TestCase seals setUp()/tearDown()
(and the static setUpBeforeClass()/tearDownAfterClass()) with a
`: void` return type and expects subclasses to override the
snake_case set_up()/tear_down()/set_up_before_class()/tear_down_after_class()
methods instead — a deliberate Polyfills design so fixture methods stay
callable on PHP versions that predate the `void` return type.
Nine test classes still declared the old camelCase methods without a
return type, which PHP considers an incompatible override of the
parent's typed declaration:
Fatal error: Declaration of WP_Block_Supports_Layout_Test::setUp()
must be compatible with Yoast\PHPUnitPolyfills\TestCases\TestCase::setUp(): void
This is fatal on every PHP-version leg where PHP itself supports typed
return declarations (7.1+), which is most of unit-test.yml's matrix.
Renames each to its Polyfills-expected name, including the
corresponding parent:: call where one exists. WP_Test_REST_Users_Controller's
wpSetUpBeforeClass()/wpTearDownAfterClass() are a separate, WP-specific
factory convention (not PHPUnit's own fixture methods) and are left as
they are.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Owner
Author
|
Moved to WordPress#84280. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Fixes a fatal error, identical across all six
PHP 7.4/8.0/8.1(single-site and multisite)unit-test.ymllegs, that blocks PHPUnit from even starting the test suite.Why?
#380 (the base of this PR) bumped
wp-phpunit/wp-phpunitto6.0.xto fix a different, unrelated PHPUnit-startup gate. That bump changedWP_UnitTestCase's own ancestry: it now chains throughyoast/phpunit-polyfills, whoseTestCaseclass sealssetUp()/tearDown()(and the staticsetUpBeforeClass()/tearDownAfterClass()) with a: voidreturn type, and instead expects subclasses to override the snake_caseset_up()/tear_down()/set_up_before_class()/tear_down_after_class()methods — a deliberate Polyfills design that keeps fixture methods callable on PHP versions that predate thevoidreturn type.Nine test classes in this repository still declare the old camelCase fixture methods with no return type, which PHP treats as an incompatible override of the parent's typed declaration:
This is fatal on every PHP-version leg where PHP itself supports typed return declarations (7.1+), which covers
7.4/8.0/8.1of the current matrix.How?
Renames each affected method to its Polyfills-expected name, including the corresponding
parent::call where one exists. Checked each of the 9 files individually rather than assuming a uniform pattern — some notable differences found along the way:phpunit/class-wp-webfonts-local-provider-test.phpalready had a correctly-namedtear_down(); only itssetUp()needed renaming.phpunit/navigation-test.php'ssetUp()/tearDown()never callparent::setUp()/parent::tearDown(), so only the method names themselves needed changing.phpunit/navigation-page-test.phpis the only file with staticsetUpBeforeClass()/tearDownAfterClass()overrides in addition to the instance methods — all four needed renaming.phpunit/class-wp-test-rest-users-controller.phpalso defineswpSetUpBeforeClass()/wpTearDownAfterClass()— a separate, WP-specific factory convention (not PHPUnit's own fixture methods) — left untouched.Testing
php -lpasses on all 9 changed files. Real CI evidence: triggered a run on this PR and confirmed the specificDeclaration of ... setUp() must be compatible with ... TestCase::setUp(): voidfatal error no longer occurs on the previously-failingPHP 7.4/8.0/8.1legs.Use of AI Tools
This PR was created by Claude Code under my supervision. All code should be treated as AI-produced and not yet reviewed by a human until this PR is marked Ready for Review.