Skip to content

SITE-1096 fix tests#114

Merged
pwtyler merged 1 commit into
feat/automated-release-workflowfrom
SITE-1096-FIX-TEST
Apr 28, 2026
Merged

SITE-1096 fix tests#114
pwtyler merged 1 commit into
feat/automated-release-workflowfrom
SITE-1096-FIX-TEST

Conversation

@tundeafolabi
Copy link
Copy Markdown
Contributor

@tundeafolabi tundeafolabi commented Apr 27, 2026

Summary

Fixes 14 test failures (12 errors + 2 failures) in the PHPUnit CI run introduced after the notices refactor in #104 and the ElasticPress HTTPS fix in #108.

ElasticPress CLI test errors (12 errors)

_pantheon_ep_force_https_url() was defined in inc/cli.php under the Pantheon\CLI namespace. That file is only loaded when WP_CLI is defined (pantheon.php:28), which is not the case in the PHPUnit test environment. This caused all Test_ElasticPress_CLI tests to fail with "Call to undefined function."

Fix: Moved _pantheon_ep_force_https_url() from inc/cli.php to inc/functions.php (namespace changes from Pantheon\CLI to Pantheon). The function is a pure string utility with no WP-CLI dependency — it only lived in cli.php by proximity to where it was called. inc/functions.php is always loaded via the bootstrap, so the function is now available in all contexts. Updated the filter callback references in cli.php and the test file accordingly.

Pantheon Updates test failures (2 failures)

Two issues in test-pantheon-updates.php:

  1. Stale assertions: The notices refactor in [SITE-5487] Notices update internal #104 replaced inline text ("Check for updates on <a href=...>your Pantheon dashboard</a>") with _pantheon_render_notice() which uses structured headings and buttons. The test assertions still checked for the old inline text. Updated to match the current notice output ("Check for Updates" heading and "A new WordPress update is available!" heading).

  2. Outdated mock version: test_pantheon_upstream_update_notice_core_not_latest mocked '6.3.1' as the "latest" available version. _pantheon_is_wordpress_core_latest() compares that against the actually installed WordPress version (now 6.9.4), so 6.3.1 <= 6.9.4 always returned true — the "update available" branch was never triggered. Changed mock to '99.0.0' so the test is not coupled to the installed WordPress version.

Test plan

  • composer lint passes
  • composer phpunit passes locally (59 tests, 0 errors, 0 failures)
  • CI passes across PHP 7.4, 8.1, 8.3, 8.4

@codacy-production
Copy link
Copy Markdown
Contributor

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

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.

@tundeafolabi tundeafolabi marked this pull request as ready for review April 27, 2026 23:59
@tundeafolabi tundeafolabi requested review from a team as code owners April 27, 2026 23:59
@pwtyler pwtyler merged commit 142f618 into feat/automated-release-workflow Apr 28, 2026
13 checks passed
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.

2 participants