Skip to content

Upgrade wp-media/phpunit to 3.3 - #1253

Merged
Miraeld merged 1 commit into
developfrom
update/wp-media-phpunit-3.3
Aug 19, 2026
Merged

Upgrade wp-media/phpunit to 3.3#1253
Miraeld merged 1 commit into
developfrom
update/wp-media-phpunit-3.3

Conversation

@remyperona

@remyperona remyperona commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

🤖 AI-generated — created by an automated pipeline. Review before acting on this.

Description

Upgrades the wp-media/phpunit dev dependency from 3.1 to ^3.3 and 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.

  • composer.json: Updated wp-media/phpunit from 3.1 to ^3.3.
  • Bootstrap paths: v3.3 relocated the package source into a src/ directory. The PSR-4 namespace (WPMedia\PHPUnit\) is unchanged, but the two hard-coded require_once bootstrap paths needed updating:
    • Tests/Unit/init-tests.phpvendor/wp-media/phpunit/src/Unit/bootstrap.php
    • Tests/Integration/init-tests.phpvendor/wp-media/phpunit/src/Integration/bootstrap.php
  • Deduplicated trait code: v3.3's TestCaseTrait now ships $config, configTestData(), and loadTestDataConfig() built in. Imagify had byte-for-byte-identical local copies in both base TestCase classes; these were removed so they are inherited from upstream (also dropped the now-unused ReflectionObject import). Net −41 lines. The widely-used @dataProvider configTestData continues to work unchanged.
  • Intentionally left alone: the Integration getApiCredential() — v3.3's ApiTrait grew 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

  • Chore

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 configTestData data-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 TestCase change is symmetric to the fully-verified unit change, and the bootstrap path fix is structurally verified — both vendor/wp-media/phpunit/src/{Unit,Integration}/bootstrap.php files exist.

How to test

Environment: PHP ≥ 7.4, Composer.

Steps:

  1. Check out this branch and run composer update wp-media/phpunit --with-dependencies (installs v3.3).
  2. Run composer test-unit — the suite bootstraps via the updated src/ paths and passes (aside from the 8 pre-existing, unrelated Imagify_WP_Background_Process errors).
  3. Run composer test-integration in 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 the wp-media/phpunit dev 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 under src/, so consumers only need to update hard-coded bootstrap require paths. It also promoted three helpers into TestCaseTrait ($config, configTestData(), loadTestDataConfig()) that this plugin previously duplicated locally; removing the local copies lets both base TestCase classes 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

  • I validated all the Acceptance Criteria. If possible, provide screenshots or videos.
  • I triggered all changed lines of code at least once without new errors/warnings/notices.
  • I implemented built-in tests to cover the new/changed code.

Code style

  • I wrote a self-explanatory code about what it does.
  • I protected entry points against unexpected inputs.
  • I did not introduce unnecessary complexity.
  • Output messages (errors, notices, logs) are explicit enough for users to understand the issue and are actionnable.

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.

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>
@codacy-production

codacy-production Bot commented Aug 19, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Coverage ∅ diff coverage

Metric Results
Coverage variation Report missing for cd27ae41
Diff coverage diff coverage (50.00%)

View coverage diff in Codacy

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.

@remyperona remyperona self-assigned this Aug 19, 2026
@remyperona
remyperona marked this pull request as ready for review August 19, 2026 19:29
@remyperona
remyperona requested review from Honemo and Miraeld August 19, 2026 19:34
@Miraeld
Miraeld added this pull request to the merge queue Aug 19, 2026
Merged via the queue into develop with commit 95b9e5f Aug 19, 2026
15 of 16 checks passed
@Miraeld
Miraeld deleted the update/wp-media-phpunit-3.3 branch August 19, 2026 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants