@@ -26,6 +26,13 @@ public function wpcli_tests_capture_email_sends( $stdout ) {
2626 /**
2727 * Launch a given command in the background.
2828 *
29+ * ```
30+ * Scenario: My example scenario
31+ * Given a WP install
32+ * And I launch in the background `wp server --host=localhost --port=8181`
33+ * ...
34+ * ```
35+ *
2936 * @access public
3037 *
3138 * @When /^I launch in the background `([^`]+)`$/
@@ -39,6 +46,25 @@ public function when_i_launch_in_the_background( $cmd ) {
3946 *
4047 * `run` expects an exit code 0, whereas `try` allows for non-zero exit codes.
4148 *
49+ * So if using `run` and the command errors, the step will fail.
50+ *
51+ * ```
52+ * Scenario: My example scenario
53+ * When I run `wp core version`
54+ * Then STDOUT should contain:
55+ * """
56+ * 6.8
57+ * """
58+ *
59+ * Scenario: My other scenario
60+ * When I try `wp i18n make-pot foo bar/baz.pot`
61+ * Then STDERR should contain:
62+ * """
63+ * Error: Not a valid source directory.
64+ * """
65+ * And the return code should be 1
66+ * ```
67+ *
4268 * @access public
4369 *
4470 * @When /^I (run|try) `([^`]+)`$/
@@ -54,6 +80,15 @@ public function when_i_run( $mode, $cmd ) {
5480 *
5581 * `run` expects an exit code 0, whereas `try` allows for non-zero exit codes.
5682 *
83+ * ```
84+ * Scenario: My example scenario
85+ * When I run `wp core is-installed`
86+ * Then STDOUT should be empty
87+ *
88+ * When I run `wp core is-installed` from 'foo/wp-content'
89+ * Then STDOUT should be empty
90+ * ```
91+ *
5792 * @access public
5893 *
5994 * @When /^I (run|try) `([^`]+)` from '([^\s]+)'$/
@@ -69,6 +104,21 @@ public function when_i_run_from_a_subfolder( $mode, $cmd, $subdir ) {
69104 *
70105 * `run` expects an exit code 0, whereas `try` allows for non-zero exit codes.
71106 *
107+ * ```
108+ * Scenario: My example scenario
109+ * When I run `wp site option update admin_user_id 1`
110+ * Then STDOUT should contain:
111+ * """
112+ * Success: Updated 'admin_user_id' site option.
113+ * """
114+ *
115+ * When I run the previous command again
116+ * Then STDOUT should contain:
117+ * """
118+ * Success: Value passed for 'admin_user_id' site option is unchanged.
119+ * """
120+ * ```
121+ *
72122 * @access public
73123 *
74124 * @When /^I (run|try) the previous command again$/
0 commit comments