Skip to content

Unit testing: Allow Composer to auto-detect PHP version - #73358

Merged
priethor merged 11 commits into
trunkfrom
fix/php-72-unit-tests
Nov 18, 2025
Merged

Unit testing: Allow Composer to auto-detect PHP version#73358
priethor merged 11 commits into
trunkfrom
fix/php-72-unit-tests

Conversation

@priethor

@priethor priethor commented Nov 17, 2025

Copy link
Copy Markdown
Contributor

What?

Fixes composer settings and unit test workflow so that Composer can auto-detect the right PHP executing the Unit Test job matrix.

Why?

It caused dependency resolution failures and broke unit tests for PHP 7.2 versions.

How?

  • Removing the platform.php setting
  • Setting the require.php setting to >=7.2.24, the current minimum PHP version supported by WordPress
  • Removing the composer override step from the unit tests workflow
@priethor
priethor force-pushed the fix/php-72-unit-tests branch from 2131388 to 8d4b14b Compare November 17, 2025 13:59
@priethor priethor changed the title Unit testing: Pin PHP 7.2 to 7.2.24 to satisfy dependencies Nov 17, 2025
Comment thread .github/workflows/unit-test.yml Outdated
# On PRs: Only test PHP 8.3, single-site, latest WP
- event: 'pull_request'
php: '7.2'
# TEMP: PHP 7.2 enabled for testing the Composer fix - do not merge

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this needs to be undone before merging; it's only there to trigger the PHP 7.2 tests in this PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excluded it again since PHP 7.2 tests pass in this PR

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually feel that this change should be reverted. But that's a discussion for another ticket.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you say more about that, so that we spin a follow-up PR?

@priethor priethor self-assigned this Nov 17, 2025
@priethor priethor added the GitHub Actions Pull requests that update GitHub Actions code label Nov 17, 2025
@priethor
priethor marked this pull request as ready for review November 17, 2025 15:27
@priethor
priethor requested a review from desrosj as a code owner November 17, 2025 15:27
@priethor priethor added the [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. label Nov 17, 2025
@github-actions

github-actions Bot commented Nov 17, 2025

Copy link
Copy Markdown

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: priethor <priethor@git.wordpress.org>
Co-authored-by: desrosj <desrosj@git.wordpress.org>
Co-authored-by: aduth <aduth@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Comment thread composer.json
Comment on lines -20 to -22
"platform": {
"php": "7.4"
},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of removing this entirely, let's change it to `"php": ">=7.2.24"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are version ranges supported in this context? 🤔

@aduth aduth Nov 17, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if this should be specified under require.php, not config.platform.

Ref: https://getcomposer.org/doc/articles/composer-platform-dependencies.md

@priethor priethor Nov 17, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Platform doesn't accept >=, only specific versions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aduth I agree require.php is a better setting for this purpose. What do you think, @desrosj ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@priethor That works for me!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 0fe9d04, with composer validate running successfully

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PHP 7.2 Unit Tests job successfully passes with the require.php setting.

@priethor
priethor force-pushed the fix/php-72-unit-tests branch from 5f9946f to 5d5922e Compare November 17, 2025 15:41
@aduth
aduth requested a review from desrosj November 18, 2025 12:59

@aduth aduth left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@priethor

Copy link
Copy Markdown
Contributor Author

@desrosj I'm going ahead and merging this to get the tests fixed on trunk, since we were all on the same page about the blocker issue, and it's already addressed.

Let me know if there is any other adjustment needed from your perspective, and I'll gladly follow up 🙏

@priethor
priethor dismissed desrosj’s stale review November 18, 2025 20:57

The feedback was addressed as agreed.

@priethor
priethor merged commit 5aea6b2 into trunk Nov 18, 2025
40 of 41 checks passed
@priethor
priethor deleted the fix/php-72-unit-tests branch November 18, 2025 20:57
@github-actions github-actions Bot added this to the Gutenberg 22.2 milestone Nov 18, 2025
priethor added a commit that referenced this pull request Nov 19, 2025
Co-authored-by: priethor <priethor@git.wordpress.org>
Co-authored-by: desrosj <desrosj@git.wordpress.org>
Co-authored-by: aduth <aduth@git.wordpress.org>
Co-authored-by: swisspidy <swisspidy@git.wordpress.org>
@priethor

Copy link
Copy Markdown
Contributor Author

Cherry-picked to wp/6.9 branch in d2eb077 to ensure PHPUnit tests pass there.

pento pushed a commit to WordPress/wordpress-develop that referenced this pull request Nov 25, 2025
Changes can be found at https://github.com/WordPress/gutenberg/commits/wp/6.9/.

  * [Fix isNewLink value with entity binding (#73368)](WordPress/gutenberg#73368)
  * [Unit testing: Allow Composer to auto-detect PHP version (#73358)](WordPress/gutenberg#73358)
  * [Move the Edit Navigation button to the last item in the block toolbar to ensure that the styling is consistent and simple 
  (#73436)](WordPress/gutenberg#73436)
  * [Block Support: Change block visibility support key (#73432)](WordPress/gutenberg#73432)
  * [Accordion: add box-sizing:border-box rule (#73507)](WordPress/gutenberg#73507)
  * [Accordion Block: Trigger panel opening from URL hash or anchor link (#73357)](WordPress/gutenberg#73357)
  * [iAPI: Backport of "Return a deep-clone object from `getServerState` and `getServerContext` functions" 
  (#73514)](WordPress/gutenberg#73514)
  * [Reuse wp_script_attributes filter for adding data-wp-router-options attribute to script module (#72489) 
  (#73512)](WordPress/gutenberg#73512)
  * [Accordion Item: Don't use grid layout (#73501)](WordPress/gutenberg#73501)
  * [Drag and drop: remove grab cursor for multi-selection (#73521)](WordPress/gutenberg#73521)
  * [Math block: fix accessibility (#73508)](WordPress/gutenberg#73508)
  * [iAPI: Fix using `getServerContext` in derived state getters (#73518) (#73531)](WordPress/gutenberg#73531)
  * [Drag: hide block tools popovers (#73539)](WordPress/gutenberg#73539)

Developed in #10549.
See https://make.wordpress.org/core/handbook/about/release-cycle/block-editor-release-process-for-major-releases/#package-updates-and-core-patches.

Props priethor.
See #64301.

git-svn-id: https://develop.svn.wordpress.org/branches/6.9@61304 602fd350-edb4-49c9-b593-d223f7449a82
markjaquith pushed a commit to markjaquith/WordPress that referenced this pull request Nov 25, 2025
Changes can be found at https://github.com/WordPress/gutenberg/commits/wp/6.9/.

  * [Fix isNewLink value with entity binding (#73368)](WordPress/gutenberg#73368)
  * [Unit testing: Allow Composer to auto-detect PHP version (#73358)](WordPress/gutenberg#73358)
  * [Move the Edit Navigation button to the last item in the block toolbar to ensure that the styling is consistent and simple 
  (#73436)](WordPress/gutenberg#73436)
  * [Block Support: Change block visibility support key (#73432)](WordPress/gutenberg#73432)
  * [Accordion: add box-sizing:border-box rule (#73507)](WordPress/gutenberg#73507)
  * [Accordion Block: Trigger panel opening from URL hash or anchor link (#73357)](WordPress/gutenberg#73357)
  * [iAPI: Backport of "Return a deep-clone object from `getServerState` and `getServerContext` functions" 
  (#73514)](WordPress/gutenberg#73514)
  * [Reuse wp_script_attributes filter for adding data-wp-router-options attribute to script module (#72489) 
  (#73512)](WordPress/gutenberg#73512)
  * [Accordion Item: Don't use grid layout (#73501)](WordPress/gutenberg#73501)
  * [Drag and drop: remove grab cursor for multi-selection (#73521)](WordPress/gutenberg#73521)
  * [Math block: fix accessibility (#73508)](WordPress/gutenberg#73508)
  * [iAPI: Fix using `getServerContext` in derived state getters (#73518) (#73531)](WordPress/gutenberg#73531)
  * [Drag: hide block tools popovers (#73539)](WordPress/gutenberg#73539)

Developed in WordPress/wordpress-develop#10549.
See https://make.wordpress.org/core/handbook/about/release-cycle/block-editor-release-process-for-major-releases/#package-updates-and-core-patches.

Props priethor.
See #64301.
Built from https://develop.svn.wordpress.org/branches/6.9@61304


git-svn-id: http://core.svn.wordpress.org/branches/6.9@60616 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GitHub Actions Pull requests that update GitHub Actions code [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.

3 participants