Skip to content

Conversation

@galatanovidiu
Copy link
Contributor

Why

Issue #19 identified that the testing.md documentation was outdated and didn't reflect the current wp-env-based testing workflow introduced in PR #18. The documentation still referenced manual database setup and Composer commands that are no longer the recommended approach for running tests.

Additionally, the testing guide was not discoverable - it wasn't linked from the main documentation index (docs/README.md) or referenced from CONTRIBUTING.md, making it difficult for contributors to find.

What

Updated docs/guides/testing.md

  • Replaced manual database/Composer setup instructions with wp-env commands
  • Updated all test commands to use npm run test:php with argument passing via --
  • Fixed coverage generation commands (npm run wp-env start -- --xdebug=coverage)
  • Corrected fixture documentation (DummyObservabilityHandler uses record_event(), not increment()/timing())
  • Added exact file paths for coverage reports (tests/_output/html/index.html)
  • Enhanced "What's Tested" section with accurate test file locations and specific test scenarios
  • Replaced "CI Recommendations" with "Continuous Integration" showing actual CI implementation (test matrix, PHP/WP versions)
  • Improved troubleshooting with context for when/why to run composer dump-autoload

Made testing guide discoverable

  • Added "Contributing" section to docs/README.md linking to both CONTRIBUTING.md and testing.md
  • Updated CONTRIBUTING.md to link to comprehensive Testing Guide instead of duplicating instructions

Verified accuracy

  • Tested all documented commands to ensure they work correctly
  • Verified test coverage claims against actual test files
  • Confirmed CI configuration details match .github/workflows/test.yml

Testing

All commands in the updated documentation have been tested and verified to work:

  • npm run test:php (all 357 tests pass)
  • npm run test:php -- --filter test_name
  • npm run test:php -- tests/Unit/Handlers/ToolsHandlerCallTest.php
  • npm run wp-env start -- --xdebug=coverage
  • ✅ Coverage report generation

Closes #19

…nd wp-env instructions

- Added a "Contributing" section to the README with a link to the Testing Guide.
- Revised the Testing Guide to emphasize the use of `wp-env` for running and writing tests, including detailed instructions for starting the test environment and running tests in both unit and integration modes.
- Enhanced coverage reporting instructions and clarified prerequisites for testing.
…ation instructions

- Updated the "Class not found" section to clarify common causes and provide a specific command for regenerating the Composer autoloader.
- Added explanation of the `--env-cwd` flag to ensure proper working directory configuration within the Docker container.
…ink to the Testing Guide for comprehensive details
Copilot AI review requested due to automatic review settings October 20, 2025 20:08
@galatanovidiu galatanovidiu self-assigned this Oct 20, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the testing documentation to reflect the current wp-env-based workflow and improves discoverability of testing resources. The changes align the documentation with the actual implementation introduced in PR #18, replacing outdated manual setup instructions with the containerized approach.

Key changes:

  • Replaced manual database/Composer testing workflow with wp-env commands
  • Made testing guide discoverable through main documentation index and CONTRIBUTING.md
  • Updated test coverage commands, fixture documentation, and CI/CD information to match actual implementation

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
docs/guides/testing.md Complete rewrite replacing manual setup with wp-env workflow, updated commands, fixture docs, and CI details
docs/README.md Added "Contributing" section linking to CONTRIBUTING.md and testing.md for better discoverability
CONTRIBUTING.md Replaced duplicated testing instructions with link to comprehensive Testing Guide

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Member

@JasonTheAdams JasonTheAdams left a comment

Choose a reason for hiding this comment

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

Mostly good, @galatanovidiu! Just one section that I'm wondering about.

@github-actions
Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: galatanovidiu <[email protected]>
Co-authored-by: JasonTheAdams <[email protected]>
Co-authored-by: justlevine <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@codecov
Copy link

codecov bot commented Oct 20, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.94%. Comparing base (040625e) to head (9f2b091).
⚠️ Report is 25 commits behind head on trunk.

Additional details and impacted files
@@            Coverage Diff            @@
##              trunk      #67   +/-   ##
=========================================
  Coverage     68.94%   68.94%           
  Complexity      821      821           
=========================================
  Files            46       46           
  Lines          3037     3037           
=========================================
  Hits           2094     2094           
  Misses          943      943           
Flag Coverage Δ
unit 68.94% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@galatanovidiu galatanovidiu merged commit b55221f into trunk Nov 3, 2025
21 checks passed
@galatanovidiu galatanovidiu deleted the docs/19-update-testing-wp-env branch November 3, 2025 17:53
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.

testing.md should use wp-env steps

3 participants