@@ -35,11 +35,7 @@ public function when_i_launch_in_the_background( $cmd ) {
3535 * @When /^I (run|try) `([^`]+)`$/
3636 */
3737 public function when_i_run ( $ mode , $ cmd ) {
38- $ with_code_coverage = (string ) getenv ( 'WP_CLI_TEST_COVERAGE ' );
39- if ( \in_array ( $ with_code_coverage , [ 'true ' , '1 ' ], true ) ) {
40- $ cmd = preg_replace ( '/(^wp )|( wp )|(\/wp )/ ' , '$1$2$3--require={SRC_DIR}/utils/generate-coverage.php ' , $ cmd );
41- }
42-
38+ $ cmd = $ this ->get_command_with_coverage ( $ cmd );
4339 $ cmd = $ this ->replace_variables ( $ cmd );
4440 $ this ->result = $ this ->wpcli_tests_invoke_proc ( $ this ->proc ( $ cmd ), $ mode );
4541 list ( $ this ->result ->stdout , $ this ->email_sends ) = $ this ->wpcli_tests_capture_email_sends ( $ this ->result ->stdout );
@@ -49,6 +45,7 @@ public function when_i_run( $mode, $cmd ) {
4945 * @When /^I (run|try) `([^`]+)` from '([^\s]+)'$/
5046 */
5147 public function when_i_run_from_a_subfolder ( $ mode , $ cmd , $ subdir ) {
48+ $ cmd = $ this ->get_command_with_coverage ( $ cmd );
5249 $ cmd = $ this ->replace_variables ( $ cmd );
5350 $ this ->result = $ this ->wpcli_tests_invoke_proc ( $ this ->proc ( $ cmd , array (), $ subdir ), $ mode );
5451 list ( $ this ->result ->stdout , $ this ->email_sends ) = $ this ->wpcli_tests_capture_email_sends ( $ this ->result ->stdout );
0 commit comments