-
Notifications
You must be signed in to change notification settings - Fork 357
Add comprehensive Behat testing guide to handbook #582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
There was a problem hiding this 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 creates a comprehensive Behat testing guide for WP-CLI contributors, consolidating documentation that was previously scattered across multiple locations. The new guide provides clear, structured documentation for writing functional tests, including SQLite as a recommended easy setup option.
Changes:
- Added new comprehensive Behat testing guide at
guides/behat-tests.mdcovering introduction, writing tests, advanced usage, best practices, and troubleshooting - Updated handbook navigation files (
index.md,guides.md) and manifest to include the new guide - Modified
contributions/pull-requests.mdto reference the comprehensive guide instead of duplicating content - Added the Delicious Brains article to external resources
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| guides/behat-tests.md | New comprehensive guide covering all aspects of Behat testing for WP-CLI, including setup with SQLite/MySQL, writing tests, advanced features, and troubleshooting |
| index.md | Added link to new Behat testing guide in the guides section |
| guides.md | Added link to new Behat testing guide |
| contributions/pull-requests.md | Streamlined functional tests section to reference the comprehensive guide, removing duplicated content |
| guides/external-resources.md | Added Delicious Brains article on writing functional tests |
| bin/handbook-manifest.json | Registered the new behat-tests guide page |
Comments suppressed due to low confidence (1)
contributions/pull-requests.md:138
- The code block is tagged with 'yml' language identifier, but Behat feature files use Gherkin syntax, not YAML. While the syntax highlighting might work, it would be more accurate to use 'gherkin' or 'cucumber' as the language identifier for better semantic accuracy.
```yml
Feature: Manage WordPress options
Scenario: Read an individual option
Given a WP install
When I run `wp option get home`
Then STDOUT should be:
"""
https://example.com
"""
</details>
---
💡 <a href="/wp-cli/handbook/new/main/.github/instructions?filename=*.instructions.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add Copilot custom instructions</a> for smarter, more guided reviews. <a href="https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn how to get started</a>.
|
|
||
| ### Getting Started | ||
|
|
||
| Every WP-CLI repository with commands has a `features/` directory containing one or more YAML-formatted `*.feature` files. |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The statement that feature files are "YAML-formatted" is incorrect. Behat feature files use Gherkin syntax, not YAML. While both use indentation and have a structured format, Gherkin is its own domain-specific language. This should be corrected to avoid confusion.
| Every WP-CLI repository with commands has a `features/` directory containing one or more YAML-formatted `*.feature` files. | |
| Every WP-CLI repository with commands has a `features/` directory containing one or more `*.feature` files written in Gherkin syntax. |
| * [Torque: Using WP CLI to Set Up a Test Version of Your Site](https://torquemag.io/using-wp-cli-to-set-up-a-test-version-of-your-site/) | ||
| * [WP Bullet Guides: Useful Bash Scripts Utilizing WP-CLI](https://guides.wp-bullet.com/category/wp-cli/) | ||
| * [WP Bullet Guides: Useful Bash Scripts Utilizing WP-CLI](https://guides.wp-bullet.com/category/wp-cli/) | ||
| * [Delicious Brains: Writing Functional Tests for WP-CLI Packages](https://deliciousbrains.com/writing-functional-tests-wp-cli-packages/) |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is trailing whitespace at the end of this line that should be removed.
| * [Delicious Brains: Writing Functional Tests for WP-CLI Packages](https://deliciousbrains.com/writing-functional-tests-wp-cli-packages/) | |
| * [Delicious Brains: Writing Functional Tests for WP-CLI Packages](https://deliciousbrains.com/writing-functional-tests-wp-cli-packages/) |
| #### Creating a test database | ||
|
|
||
| Before running the functional tests, you'll need a MySQL (or MariaDB) user called `wp_cli_test` with the password `password1` that has full privileges on the MySQL database `wp_cli_test`. |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section only mentions MySQL/MariaDB database setup, but the new comprehensive guide recommends SQLite as the easiest option. Consider adding a note here that SQLite can be used as an alternative by setting WP_CLI_TEST_DBTYPE=sqlite, which requires no database setup. This would be consistent with the new guide and provide a simpler path for contributors.
Created comprehensive Behat tests documentation guide:
guides/behat-tests.mdwith comprehensive Behat testing documentationguides.mdto include link to new Behat tests guideindex.mdto include link to new Behat tests guidebin/handbook-manifest.jsonto register the new guidecontributions/pull-requests.mdto link to the new comprehensive guideguides/external-resources.mdto add the Delicious Brains articlecomposer prepare-testsfor MySQL setupcomposer behatautomatically detects database availabilityThe guide now clearly explains that contributors can simply run
composer behatwithout any database setup, as it will automatically use SQLite when needed.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.