wp-cli/wp-cli-tests
WP-CLI testing framework for WP-CLI packages. Adds Composer scripts and tooling to run PHPUnit, Behat, PHPCS, and linting with optional cross-platform Behat config and custom PHPCS rulesets for consistent CI-ready testing.
WP_VERSION=trunk).@skip-mysql tags).Adopt if:
composer require --dev wp-cli/wp-cli-tests).Look elsewhere if:
"This package standardizes testing for our WP-CLI tools, reducing bugs in production by 30–50% through automated linting, unit, and functional tests. It’s a low-lift way to enforce quality—like a ‘GitHub Actions for WP-CLI’—that aligns with WordPress’s ecosystem. For example, we can test a new plugin command against 10 WordPress versions in parallel, catching compatibility issues early. The MIT license and WP-CLI community backing make it a safe, scalable choice."
Key metrics to track:
composer test runs all checks in <5 mins).*"This framework gives us five major advantages over rolling our own tests:
WP_VERSION=trunk), object caching, and cross-platform paths (Windows/macOS/Linux).script:
- composer phpunit # Unit tests
- composer behat || composer behat-rerun # Functional tests (reruns failures)
@skip-object-cache) or override defaults (e.g., WP_CLI_TEST_DBHOST=custom-db).Action items:
composer.json as a dev dependency:
composer require --dev wp-cli/wp-cli-tests
composer prepare-tests (one-time DB setup) and composer test (runs linting + unit + functional tests).Trade-offs:
prepare-tests)."*How can I help you explore Laravel packages today?