Upgrade wp-media/phpunit to 3.3 - #1253
Conversation
Bump wp-media/phpunit from 3.1 to ^3.3 and adapt to its changes. - Update the bootstrap require paths for the package's move to `src/` (the PSR-4 namespace is unchanged, only the two hard-coded require paths in init-tests.php needed updating). - Drop the local `$config`, `configTestData()` and `loadTestDataConfig()` copies from the Unit and Integration base TestCase classes: v3.3's `TestCaseTrait` now ships them with identical behavior, so they are inherited from upstream instead of duplicated here. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Coverage variation | Report missing for cd27ae41 |
| Diff coverage | ✅ ∅ diff coverage (50.00%) |
Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (cd27ae4) Report Missing Report Missing Report Missing Head commit (10a4ab3) 20475 1613 7.88% Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>
Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#1253) 0 0 ∅ (not applicable) Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%
1 Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Description
Upgrades the
wp-media/phpunitdev dependency from3.1to^3.3and adapts the test suite to the changes introduced in v3.3. This is test tooling only and has no impact on plugin users or runtime behavior.wp-media/phpunitfrom3.1to^3.3.src/directory. The PSR-4 namespace (WPMedia\PHPUnit\) is unchanged, but the two hard-codedrequire_oncebootstrap paths needed updating:Tests/Unit/init-tests.php→vendor/wp-media/phpunit/src/Unit/bootstrap.phpTests/Integration/init-tests.php→vendor/wp-media/phpunit/src/Integration/bootstrap.phpTestCaseTraitnow ships$config,configTestData(), andloadTestDataConfig()built in. Imagify had byte-for-byte-identical local copies in both baseTestCaseclasses; these were removed so they are inherited from upstream (also dropped the now-unusedReflectionObjectimport). Net −41 lines. The widely-used@dataProvider configTestDatacontinues to work unchanged.getApiCredential()— v3.3'sApiTraitgrew a similar method, but Imagify's is non-static with a different lookup order and a fixed path, so it is not a clean drop-in and replacing it would change behavior.Type of change
Detailed scenario
What was tested
Automated: the full PHPUnit unit suite was run locally against v3.3 (
composer test-unit). Result: 490 tests. All@dataProvider configTestDatadata-provider tests pass against the now-inherited trait, confirming the dedup is behavior-preserving.The integration suite was not run locally (it requires the WP test DB / wp-env infrastructure). The integration
TestCasechange is symmetric to the fully-verified unit change, and the bootstrap path fix is structurally verified — bothvendor/wp-media/phpunit/src/{Unit,Integration}/bootstrap.phpfiles exist.How to test
Environment: PHP ≥ 7.4, Composer.
Steps:
composer update wp-media/phpunit --with-dependencies(installs v3.3).composer test-unit— the suite bootstraps via the updatedsrc/paths and passes (aside from the 8 pre-existing, unrelatedImagify_WP_Background_Processerrors).composer test-integrationin a configured WP test environment to confirm the integration bootstrap path resolves.Affected Features & Quality Assurance Scope
Test suite only (
Tests/Unit,Tests/Integration) and thewp-media/phpunitdev dependency. No production/runtime code is touched, so there is no user-facing feature impact. QA scope is limited to confirming the unit and integration test suites bootstrap and run in CI.Technical description
Documentation
The v3.3 package keeps the same public API (namespace
WPMedia\PHPUnit\) but relocated its files undersrc/, so consumers only need to update hard-coded bootstraprequirepaths. It also promoted three helpers intoTestCaseTrait($config,configTestData(),loadTestDataConfig()) that this plugin previously duplicated locally; removing the local copies lets both baseTestCaseclasses inherit the upstream implementations, which are behavior-identical (configTestData()returns$config['test_data'] ?? $config, lazily loaded from the fixture file matching the test class).Mandatory Checklist
Code validation
Code style
Unticked items justification
This is a
Chore: a dev-dependency upgrade (wp-media/phpunit) touching only the test suite, with no production code, no new user-facing behavior, and no new acceptance criteria. The relevant validation is the automated unit suite, which was run and passes (see "What was tested"). The remaining checklist items concern production code changes and user-facing output and are therefore not applicable.