Content type: Handbook

  • Given these installed and active plugins:

    Installs and activates one or more plugins. Usage Scenario: My example scenario Given a WP installation And these installed and active plugins: “”” akismet wordpress-importer “”” 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 /^an? ([^s]+) (file|cache file):$/

    Creates a file with the given contents. Usage The file can be created either in the current working directory or in the cache directory. Scenario: My example scenario Given a wp-cli.yml file: “”” @foo: path: foo user: admin “”” Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please…

  • Given wp-config.php

    Create a wp-config.php file using wp config create. Usage Scenario: My example scenario Given an empty directory And WP files And wp-config.php 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)…

  • Given WP files

    Download WordPress files without installing. Usage Scenario: My example scenario Given an empty directory And WP files 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]+) directory$/ – Creates or…

  • Then /^an email should (be sent|not be sent)$/

    Expect an email to be sent (or not). Usage Scenario: My example scenario When I run `wp user reset-password 1` Then an email should be sent Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request. Related Then /^the return code should( not)? be (\d+)$/…

  • 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…

  • Given /^that HTTP requests to (.*?) will respond with:$/

    Mock HTTP requests to a given URL. Usage Scenario: My example scenario Given that HTTP requests to https://api.github.com/repos/wp-cli/wp-cli/releases?per_page=100 will respond with: “”” HTTP/1.1 200 Content-Type: application/json { “foo”: “bar” } “”” 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…