Skip to content

Support beta versions in install-wp-tests.sh and fix shellcheck findings - #408

Merged
swissspidy merged 1 commit into
mainfrom
fix/install-wp-tests-beta-shellcheck
Nov 24, 2026
Merged

swissspidy merged 1 commit into
mainfrom
fix/install-wp-tests-beta-shellcheck

Conversation

@swissspidy

@swissspidy swissspidy commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Supersedes #389 by @nextgenthemes, whose fork has since been archived, so the PR can't be updated anymore. Their changes are kept and credited as co-author, with the review feedback addressed.

Beta versions

The test suite's release branch (e.g. branches/7.1) only exists from RC1 on, so installing the tests for a beta like 7.1-beta1 failed. Beta versions now use the test suite from trunk. RC versions keep using the release branch. WordPress itself is still downloaded from wordpress.org, which hosts beta archives.

Shellcheck

The template is now free of shellcheck findings (main has 30). Compared to #389, this fixes two regressions it introduced:

  • --password="$DB_PASS""$EXTRA" glued the --host/--port options onto the password whenever a DB host was given, so every connection failed. That's why all MySQL Behat jobs failed on Fix beta versions, apply fixes for shellcheck hints #389. The options are now passed as a Bash array ("${EXTRA[@]}").
  • Switching the version escaping from backticks to $() changed 6\.9 into 6\\.9, breaking the minor version lookup. It now uses ${WP_VERSION//./\\.}.

Trailing slashes are still stripped from WP_CORE_DIR entirely (not just one), using a shell loop instead of sed.

Testing

  • shellcheck templates/install-wp-tests.sh reports nothing.
  • I ran the script against a local MariaDB with 127.0.0.1:3306, 127.0.0.1 and localhost as the host. Both creating and recreating the database work.
  • Downloading the test suite archive from GitHub isn't possible in my environment, so that part is left to CI.

Generated by Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved database connection handling for hosts with optional ports or sockets, and preserved command-line options consistently.
    • Fixed test-suite selection for beta WordPress versions; release candidates continue to use their matching branch.
    • Improved handling of filesystem paths and version matching during test setup.

The release branch of the test suite only exists from RC1 on, so beta
versions now use the test suite from trunk while RC versions keep using
the release branch.

Also quote variables and fix the other shellcheck findings. The database
options are passed as an array, so a host and port are no longer glued
onto the password argument.

Supersedes #389.

Co-Authored-By: nextgenthemes <nextgenthemes@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UWTd5pwpi2xQfDA6mUYkkx
@swissspidy
swissspidy requested a review from a team as a code owner November 24, 2026 13:57
Copilot AI balanced review requested due to automatic review settings November 24, 2026 13:57
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The installer now quotes paths in WordPress setup and test configuration operations, selects the trunk test suite for beta versions, and passes database host options as separate command arguments.

Changes: WordPress test installer

Layer / File(s) Summary
WordPress setup and paths
templates/install-wp-tests.sh
Beta versions now select the trunk test suite. WordPress and test-suite setup quote filesystem paths. Test configuration removes trailing slashes from WP_CORE_DIR iteratively.
Database connection arguments
templates/install-wp-tests.sh
Database commands pass host options as separate arguments. install_db selects TCP host, TCP host-and-port, or socket options based on the host suffix. Confirmation input is read with -r and passed quoted to recreate_db.

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Bug fix

Suggested reviewers: danielbachhuber, tedsecretsource, copilot

Merge Risk: Minimal · up to a59b9

The installer script now handles beta versions and paths containing spaces, and it passes database host options correctly. No actionable merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the two main changes in the PR: beta version support in install-wp-tests.sh (beta versions select the trunk test suite) and fixing ShellCheck findings. The raw summary and objectives b…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the two main changes in the PR: beta version support in install-wp-tests.sh (beta versions select the trunk test suite) and fixing ShellCheck findings. The raw summary and objectives both describe these changes, so the title matches the changeset. It does not mention the database host array or version escaping changes, which is expected for a title.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4373cfbc-1dcd-4e9a-ad2c-ca8dddcfdf1e
Commits

Reviewing files that changed from the base of the PR and between 8c3e69a and a59b9d0.

Files selected for processing: 1

  • templates/install-wp-tests.sh

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@github-actions github-actions Bot added bug command:scaffold-plugin-tests Related to 'scaffold plugin-tests' command command:scaffold-theme-tests Related to 'scaffold theme-tests' command scope:testing Related to testing labels Nov 24, 2026
@codecov

codecov Bot commented Nov 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@swissspidy
swissspidy merged commit 81a17c9 into main Nov 24, 2026
60 checks passed
@swissspidy
swissspidy deleted the fix/install-wp-tests-beta-shellcheck branch November 24, 2026 14:51
@github-actions github-actions Bot added this to the 3.0.4 milestone Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug command:scaffold-plugin-tests Related to 'scaffold plugin-tests' command command:scaffold-theme-tests Related to 'scaffold theme-tests' command scope:testing Related to testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants