Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Wp Cli Tests

Wp Cli Tests Laravel Package

wp-cli/wp-cli-tests

WP-CLI testing framework that bundles shared Behat, PHPUnit, PHP_CodeSniffer, and PHPStan tooling for WP-CLI commands and packages. Add it as a dev dependency to get ready-made test scripts, Behat feature contexts, and linting configs out of the box.

View on GitHub
Deep Wiki
Context7

WP-CLI testing framework

Frequently asked questions about Wp Cli Tests
Can I use wp-cli/wp-cli-tests in a Laravel application?
Not as a native Laravel testing stack. It targets WP-CLI and WordPress CLI projects and brings Behat, PHP_CodeSniffer, PHPStan, PHPUnit, and lint scripts. Laravel applications normally use PHPUnit or Pest, Laravel Dusk, and Pint. Consider it only for hybrid Laravel and WordPress CLI projects that require WordPress functional tests.
What does wp-cli/wp-cli-tests include?
It is a Composer-installed testing framework that adds Behat for BDD, PHP_CodeSniffer for coding standards, PHPStan for static analysis, PHPUnit for unit tests, and lint scripts. It provides Composer scripts such as behat, lint, phpcs, phpstan, phpunit, prepare-tests, and test. Optional behat.yml and phpcs.xml.dist files help standardize configuration across platforms.
How do I install wp-cli/wp-cli-tests?
Add it as a development dependency with composer require --dev wp-cli/wp-cli-tests. Then add the required scripts to the scripts section of composer.json, such as behat, lint, phpcs, phpstan, phpunit, prepare-tests, and test. Optionally set a longer process-timeout and add behat.yml or phpcs.xml.dist for cross-platform and coding-standard configuration. Run composer prepare-tests before running composer test.
Does wp-cli/wp-cli-tests support Laravel 10 or Laravel 11?
No, it does not provide Laravel version support because it is built for WP-CLI and WordPress CLI projects. Its compatibility concerns are PHP, WordPress, WP-CLI, Behat, PHPCS, PHPStan, and PHPUnit versions rather than Laravel releases. For Laravel 10 or 11, use Laravel's native PHPUnit or Pest setup, Laravel Dusk, and Pint. Only integrate this package through a clearly isolated hybrid WordPress and Laravel workflow.
Why would a Laravel team use Behat instead of Laravel Dusk?
Behat may be chosen when the team needs BDD-style feature files or non-technical stakeholders want readable scenarios. However, Laravel Dusk is the Laravel-native browser testing option and integrates with Laravel's ecosystem. This package uses Behat for WP-CLI functional tests that require WordPress, not for Laravel container, Artisan, Eloquent, or queue testing. A team should justify Behat against the extra toolchain fragmentation it introduces.
How do I configure Behat and PHPCS with wp-cli/wp-cli-tests?
Add an optional behat.yml file at the package root that references the WP_CLI Tests FeatureContext and the features path. Add a phpcs.xml.dist ruleset based on the WP-CLI defaults if you want PHP_CodeSniffer checks. The Composer scripts then run commands such as run-behat-tests, run-phpcs-tests, run-phpstan-tests, and run-php-unit-tests. The behat.yml file is especially relevant for consistent behavior on Windows.
Can wp-cli/wp-cli-tests run in GitHub Actions or GitLab CI?
Yes, but expect to customize the CI configuration. The package documentation provides Travis CI examples, while GitHub Actions and GitLab CI need their own setup for PHP, WordPress, database services, and Composer scripts. You will typically run composer prepare-tests followed by composer test or individual scripts. Laravel projects using Forge, Envoyer, or Dockerized CI should isolate the WP-CLI test job and database from the Laravel test suite.
What database does wp-cli/wp-cli-tests use, and will it conflict with Laravel tests?
The framework sets up a dedicated MySQL or SQLite test database named wp_cli_test. It can conflict with a Laravel test database such as laravel_test if both suites share the same environment without isolation. Use Docker, separate schemas, or CI service containers to keep the databases apart. Run WP-CLI functional tests separately from Laravel migrations and test preparation.
What are alternatives to wp-cli/wp-cli-tests for Laravel projects?
For Laravel applications, the native alternatives are PHPUnit or Pest, Laravel Dusk for browser tests, Laravel Pint for linting, and Larastan or PHPStan for static analysis. For Laravel packages, laravel/testbench is often more appropriate than a WordPress-oriented test harness. For hybrid WordPress and Laravel projects, use wp-cli/wp-cli-tests only for WP-CLI functional coverage while keeping Laravel tests in the Laravel stack. Avoid it entirely when the project has no WordPress or WP-CLI dependency.
How is wp-cli/wp-cli-tests maintained, and what production risks should I consider?
It is maintained in the wp-cli/wp-cli-tests repository with CI and code coverage badges, and it is intended as a development dependency rather than production runtime code. Maintenance work includes tracking WP-CLI, WordPress, PHP, Behat, PHPCS, PHPStan, and PHPUnit updates. Risks include toolchain fragmentation, WordPress environment coupling, CI customization, Windows-specific quirks, and database isolation problems. Pin dependency versions and assign ownership for upgrades before adopting it in a hybrid project.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
muka/shape-reader
tdt/json
refinery29/php-cs-fixer-config
hotmeteor/eco-env
mvaliolahi/hydrate
wearede/tbcpay-php
parsnick/steak
thibaud-dauce/mattermost-php
multilinguals/apollo-client
antaresbr/collection
kr0lik/phpstan-rules
loco/loco
starfederation/datastar-php
yupmin/modern-phystrix
stephenjude/extended-artisan-commands
lumphp/laravel-macroable
lumphp/laravel-collections
lumphp/laravel-contracts
sermepa/sermepa
arkecosystem/fortify