title: "Then /^the return code should( not)? be (\d+)$/" post_status: publish comment_status: open taxonomy: category: - wp-cli-handbook post_tag: - Behat Steps - Repos - Data
Then /^the return code should( not)? be (\d+)$/
检查先前命令的退出码是否符合预期。
用法
Scenario: 我的示例场景
Given 一个 WP 安装
When 我尝试执行 `wp plugin install`
Then 返回码应为 1
Behat 步骤文档随每个 WP-CLI 版本发布自动生成。如需改进,请提交 Pull Request。
相关
- Then /^(STDOUT|STDERR) should( strictly)? (be|contain|not contain):$/ - 检查 STDOUT 或 STDERR 的内容。
- Then /^(STDOUT|STDERR) should be a number$/ - 期望 STDOUT 或 STDERR 是一个数值。
- Then /^(STDOUT|STDERR) should not be a number$/ - 期望 STDOUT 或 STDERR 不是一个数值。
- Then /^STDOUT should be a table containing rows:$/ - 期望 STDOUT 是一个包含给定行的表格。
- Then /^STDOUT should end with a table containing rows:$/ - 期望 STDOUT 以一个包含给定行的表格结尾。
- Then /^STDOUT should be JSON containing:$/ - 期望 STDOUT 中包含有效的 JSON 输出。
- Then /^STDOUT should be a JSON array containing:$/ - 期望 STDOUT 中包含有效的 JSON 数组输出。
- Then /^STDOUT should be CSV containing:$/ - 期望 STDOUT 是包含特定值的 CSV。
- Then /^STDOUT should be YAML containing:$/ - 期望 STDOUT 是包含特定内容的 YAML。
- Then /^(STDOUT|STDERR) should be empty$/ - 期望 STDOUT 或 STDERR 为空。
- Then /^(STDOUT|STDERR) should not be empty$/ - 期望 STDOUT 或 STDERR 不为空。
- Then /^(STDOUT|STDERR) should be a version string (<|<=|>|>=|==|=|!=|<>) ([+\w.{}-]+)$/ - 期望 STDOUT 或 STDERR 是一个版本字符串,并与给定版本进行比较。
- Then /^the (.+) (file|directory) should( strictly)? (exist|not exist|be:|contain:|not contain:)$/ - 期望某个文件或目录(不)存在或(不)包含特定内容。
- Then /^the contents of the (.+) file should( not)? match (((\/.+\/)|(#.+#))([a-z]+)?)$/ - 使用正则表达式匹配文件内容。
- Then /^(STDOUT|STDERR) should( not)? match (((\/.+\/)|(#.+#))([a-z]+)?)$/ - 使用正则表达式匹配 STDOUT 或 STDERR。
- Then /^an email should (be sent|not be sent)$/ - 期望发送(或不发送)一封电子邮件。
- Then the HTTP status code should be :code - 期望访问 `http://localhost:8080` 时的 HTTP 状态码。