Content type: Handbook

  • Given download:

    Download multiple files into the given destinations. Usage Scenario: My example scenario Given download: | path | url | | {CACHE_DIR}/foo.jpg | https://example.com/foo.jpg | | {CACHE_DIR}/bar.png | https://example.com/another-image.png | Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request. Related Given an empty directory –…

  • Given /^"([^"]+)" replaced with "([^"]+)" in the ([^s]+) file$/

    Search and replace a string in a file using regex. Usage Scenario: My example scenario Given “Foo” replaced with “Bar” in the readme.html file … Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request. Related Given an empty directory – Creates an empty directory.…

  • Given /^save (STDOUT|STDERR) ([’].+[^’])?s?as {(w+)}$/

    Store STDOUT or STDERR contents in a variable. Usage Scenario: My example scenario When I run `wp package path` Then save STDOUT as {PACKAGE_PATH} Scenario: My other scenario When I run `wp core download` Then save STDOUT ‘Downloading WordPress ([\d\.]+)’ as {VERSION} Behat steps documentation is generated from the WP-CLI codebase on every release. To…

  • Given /^save the (.+) file ([’].+[^’])?as {(w+)}$/

    Stores the contents of the given file in a variable. Usage Scenario: My example scenario Given a WP installation with Composer And save the {RUN_DIR}/composer.json file as {COMPOSER_JSON} Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request. Related Given an empty directory – Creates…

  • WP_CLIUtilswrite_csv()

    Write data as CSV to a given file. Usage WP_CLI\Utils\write_csv( $fd, $rows, $headers = [] ) $fd (resource) File descriptor. $rows (array<string[]>|iterable) Array of rows to output. $headers (array<string>) List of CSV columns (optional). Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request. Related…

  • WP_CLI::warning()

    Display warning message prefixed with “Warning: “. Usage WP_CLI::warning( $message ) $message (string|WP_Error|Exception|Throwable) Message to write to STDERR. @return (void) Notes Warning message is written to STDERR, or discarded when –quiet flag is supplied. Use instead of WP_CLI::debug() when script execution should be permitted to continue. # `wp plugin activate` skips activation when plugin is…

  • Given a custom wp-content directory

    Configure a custom wp-content directory. Usage Defines the WP_CONTENT_DIR, WP_PLUGIN_DIR, and WPMU_PLUGIN_DIR constants. Scenario: My example scenario Given a WP install And a custom wp-content directory Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request. Related Given an empty directory – Creates an empty…

  • Given a database

    Creates an empty database. Usage Has no effect when tests run with SQLite. Scenario: My example scenario Given a database … Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request. Related Given an empty directory – Creates an empty directory. Given /^an? (empty|non-existent) ([^\s]+)…

  • Given a dependency on current wp-cli

    Add wp-cli/wp-cli as a Composer dependency. Usage Scenario: My example scenario Given a WP installation with Composer And a dependency on current wp-cli Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request. Related Given an empty directory – Creates an empty directory. Given /^an?…

  • Given /^a downloaded Phar with (?:the same version|version "([^"]+)")$/

    Download a specific WP-CLI Phar version from GitHub. Usage Scenario: My example scenario Given an empty directory And a downloaded Phar with version “2.11.0” Scenario: My other scenario Given an empty directory And a downloaded Phar with the same version Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements,…