mirror of
https://gh.wpcy.net/https://github.com/wp-cli/handbook.git
synced 2026-04-27 02:32:41 +08:00
- Organize files in folders according to the desired structure - Use directory iterator to loop through all files and folders (makes generation more robust)
5 KiB
5 KiB
Then /^STDOUT should end with a table containing rows:$/
Expect STDOUT to end with a table containing the given rows.
Usage
Useful when the table is preceded by some other output.
Scenario: My example scenario
Given a WP installation
When I run `wp search-replace foo bar --report-changed-only`
Then STDOUT should contain:
"""
Success: Made 3 replacements.
"""
And STDOUT should end with a table containing rows:
| Table | Column | Replacements | Type |
| wp_options | option_value | 1 | PHP |
| wp_postmeta | meta_value | 1 | SQL |
| wp_posts | post_title | 1 | SQL |
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+)$/ - Expect a specific exit code of the previous command.
- Then /^(STDOUT|STDERR) should( strictly)? (be|contain|not contain):$/ - Check the contents of STDOUT or STDERR.
- Then /^(STDOUT|STDERR) should be a number$/ - Expect STDOUT or STDERR to be a numeric value.
- Then /^(STDOUT|STDERR) should not be a number$/ - Expect STDOUT or STDERR to not be a numeric value.
- Then /^STDOUT should be a table containing rows:$/ - Expect STDOUT to be a table containing the given rows.
- Then /^STDOUT should be JSON containing:$/ - Expect valid JSON output in STDOUT.
- Then /^STDOUT should be a JSON array containing:$/ - Expect valid JSON array output in STDOUT.
- Then /^STDOUT should be CSV containing:$/ - Expect STDOUT to be CSV containing certain values.
- Then /^STDOUT should be YAML containing:$/ - Expect STDOUT to be YAML containig certain content.
- Then /^(STDOUT|STDERR) should be empty$/ - Expect STDOUT or STDERR to be empty.
- Then /^(STDOUT|STDERR) should not be empty$/ - Expect STDOUT or STDERR not to be empty.
- Then /^(STDOUT|STDERR) should be a version string (<|<=|>|>=|==|=|!=|<>) ([+\w.{}-]+)$/ - Expect STDOUT or STDERR to be a version string comparing to the given version.
- Then /^the (.+) (file|directory) should( strictly)? (exist|not exist|be:|contain:|not contain:)$/ - Expect a certain file or directory to (not) exist or (not) contain certain contents.
- Then /^the contents of the (.+) file should( not)? match (((\/.+\/)|(#.+#))([a-z]+)?)$/ - Match file contents against a regex.
- Then /^(STDOUT|STDERR) should( not)? match (((\/.+\/)|(#.+#))([a-z]+)?)$/ - Match STDOUT or STDERR against a regex.
- Then /^an email should (be sent|not be sent)$/ - Expect an email to be sent (or not).
- Then the HTTP status code should be :code - Expect the HTTP status code for visiting `http://localhost:8080`.