Skip to content

Fix PHPUnit bootstrap setup#26

Merged
erseco merged 1 commit intomainfrom
feature/try-again
Oct 14, 2025
Merged

Fix PHPUnit bootstrap setup#26
erseco merged 1 commit intomainfrom
feature/try-again

Conversation

@erseco
Copy link
Copy Markdown
Collaborator

@erseco erseco commented Oct 14, 2025

Summary

  • point the Composer test script at the existing phpunit Composer script so the bundled executable is used
  • bootstrap PHPUnit via Yoast WP Test Utils helpers to locate the WordPress test suite and surface a clear error when it is missing

Testing

  • composer test (fails: The WordPress native unit test bootstrap file could not be found)

https://chatgpt.com/codex/tasks/task_e_68edfc590eac832291c255438b26d755

@erseco erseco merged commit 429e281 into main Oct 14, 2025
2 of 3 checks passed
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting

Comment thread tests/bootstrap.php
Comment on lines 20 to +21
// Give access to tests_add_filter() function.
require_once "{$_tests_dir}/includes/functions.php";
require_once $_tests_dir . 'includes/functions.php';
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Require WordPress test helper using path without separator

After switching to WPIntegration\get_path_to_wp_test_dir() the include now concatenates the tests directory and includes/functions.php without adding a /. get_path_to_wp_test_dir() returns whatever was provided via WP_TESTS_DIR/WP_DEVELOP_DIR; when those variables omit a trailing slash (common in the official setup instructions) the resulting path becomes …wordpress-tests-libincludes/functions.php and the bootstrap immediately fails with No such file or directory. Append an explicit slash (e.g. $_tests_dir . '/includes/functions.php') or normalize the path before including so tests can run regardless of how the environment variable is formatted.

Useful? React with 👍 / 👎.

@erseco erseco deleted the feature/try-again branch November 30, 2025 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant