Repository navigation
Fix wp ability list --format=ids output - #16
softglazee wants to merge 1 commit into
Conversation
The `ids` format of the formatter expects plain values, but the ability rows were passed as arrays, which printed "Array" once per ability and an "Array to string conversion" warning each. Pass the ability names instead, the same way `wp cron event list` passes the hook names.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
|
Hello! 👋 Thanks for opening this pull request! Please check out our contributing guidelines. We appreciate you taking the initiative to contribute to this project. Contributing isn't limited to just code. We encourage you to contribute in the way that best fits your abilities, by writing tutorials, giving a demo at your local meetup, helping other users with their support questions, or revising our documentation. Here are some useful Composer commands to get you started:
To run a single Behat test, you can use the following command: # Run all tests in a single file
composer behat features/some-feature.feature
# Run only a specific scenario (where 123 is the line number of the "Scenario:" title)
composer behat features/some-feature.feature:123You can find a list of all available Behat steps in our handbook. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
wp ability listdocumentsidsas a format, but the ability rows were passed to the formatter as arrays. The output wasArray Array ...with one "Array to string conversion" warning per ability.This PR passes the ability names to the formatter when
--format=idsis used, the same waywp cron event listpasses the hook names, and adds a Behat step for it.Fixes #15
Testing Instructions
Environment
main(a1735b03), ability-commandmain(7a6437b) with this PRSteps to Reproduce
wp ability list --format=idsArray Array Array Array Array Arrayand STDERR has sixWarning: Array to string conversion in .../php/WP_CLI/Formatter.php on line 384lines.Expected Results
core/get-site-info core/get-user-info core/get-environment-info core/settings-get core/users-query core/content-query.--field=nameare unchanged.With this PR on the same site (run from the ability-command checkout):
STDERR was empty and the exit code was 0.
Test results
Behat ran with
WP_VERSION=nightly, PHP 8.5.9 and MariaDB 11.8.9.Before, on
main:After, with this PR:
Full suite with this PR (
features/, without the two@less-than-wp-6.9scenarios, which do not apply to the nightly): 16 scenarios (16 passed), 143 steps (143 passed).composer phpcs -- src/Ability_Command.phpandcomposer phpstanreport no errors. The Gherkin linter (gherkin-lint-plus 1.0.2 with the wp-cli-tests config) passes onfeatures/ability.feature.AI assistance: Yes. I used an AI assistant to help investigate and draft this; I ran and checked every test and result myself.