Feature: Bootstrap WP-CLI Background: When I run `wp package path` And save STDOUT as {PACKAGE_PATH} And I run `rm -rf {PACKAGE_PATH}/vendor` And I run `rm -rf {PACKAGE_PATH}/composer.json` And I run `rm -rf {PACKAGE_PATH}/composer.lock` @less-than-php-7.4 @require-opcache-save-comments Scenario: Basic Composer stack Given an empty directory And a composer.json file: """ { "name": "wp-cli/composer-test", "type": "project", "require": { "wp-cli/wp-cli": "1.1.0" } } """ # Note: Composer outputs messages to stderr. And I run `composer install --no-interaction 2>&1` When I run `vendor/bin/wp cli version` Then STDOUT should contain: """ WP-CLI 1.1.0 """ Scenario: Composer stack with override requirement before WP-CLI Given a WP installation And a composer.json file: """ { "name": "wp-cli/composer-test", "type": "project", "minimum-stability": "dev", "prefer-stable": true, "repositories": [ { "type": "path", "url": "./override", "options": { "symlink": false } } ], "require": { "wp-cli/override": "*", "wp-cli/wp-cli": "dev-main" } } """ And a override/override.php file: """ 'before_wp_load' ) ); """ And a override/src/Eval_Command.php file: """ &1` When I run `vendor/bin/wp eval '\WP_CLI::Success( "WP-Standard-Eval" );'` Then STDOUT should contain: """ Success: WP-Override-Eval """ Scenario: Override command bundled with current source Given a WP installation And a override/override.php file: """ 'before_wp_load' ) ); // Override bundled command. WP_CLI::add_command( 'eval', 'Eval_Command', array( 'when' => 'before_wp_load' ) ); """ And a override/src/CLI_Command.php file: """ &1` When I run `wp cli version` Then STDOUT should contain: """ WP-CLI """ When I run `wp eval '\WP_CLI::Success( "WP-Standard-Eval" );'` Then STDOUT should contain: """ Success: WP-Standard-Eval """ When I run `wp --require=override/override.php cli version` Then STDOUT should contain: """ WP-Override-CLI """ When I run `wp --require=override/override.php eval '\WP_CLI::Success( "WP-Standard-Eval" );'` Then STDOUT should contain: """ Success: WP-Override-Eval """ Scenario: Override command through package manager Given a WP installation And a override/override.php file: """ 'before_wp_load' ) ); // Override bundled command. WP_CLI::add_command( 'eval', 'Eval_Command', array( 'when' => 'before_wp_load' ) ); """ And a override/src/CLI_Command.php file: """ &1` When I run `vendor/bin/wp option get blogname` Then STDOUT should contain: """ WP CLI Site with both WordPress and wp-cli as Composer dependencies """ @broken @require-php-7.0 Scenario: Composer stack with both WordPress and wp-cli as dependencies (web) Given a WP installation with Composer And a dependency on current wp-cli And a PHP built-in web server to serve 'WordPress' Then the HTTP status code should be 200 @require-php-7.0 Scenario: Composer stack with both WordPress and wp-cli as dependencies and a custom vendor directory Given a WP installation with Composer and a custom vendor directory 'vendor-custom' And a dependency on current wp-cli # Redirect STDERR to STDOUT as Composer produces non-error output on STDERR And I run `composer require wp-cli/entity-command --with-all-dependencies --no-interaction 2>&1` When I run `vendor-custom/bin/wp option get blogname` Then STDOUT should contain: """ WP CLI Site with both WordPress and wp-cli as Composer dependencies """ Scenario: Setting an environment variable passes the value through Given an empty directory And WP files And a database And a env-var.php file: """