polevaultweb / phpunit-wp-cli-runner
Helper to test custom WP-CLI commands by bootstrapping WP-CLI in PHPUnit
Installs: 4 915
Dependents: 0
Suggesters: 0
Security: 0
Stars: 9
Watchers: 3
Forks: 1
Open Issues: 0
Requires
- wp-cli/wp-cli: 0.20.*
This package is not auto-updated.
Last update: 2024-12-21 20:46:48 UTC
README
Helper to test custom WP-CLI commands by bootstrapping WP-CLI in PHPUnit
Installation
To install simply require the package in the composer.json
file like
"require-dev": { "polevaultweb/phpunit-wp-cli-runner": "master@dev" }
Then use composer update
to fetch the package.
Bootstrap
In your PHPUnit bootstrap.php
file you will need add the following:
$vendorDir = '/path/to/vendor'; \Polevaultweb\PHPUnit_WP_CLI_Runner\Runner::init( $vendorDir );
Then WP-CLI will be loaded whenever you instantiate your custom CLI command classes in your unit tests cases.
See the blog post for more information.