public $variables = array();
private static function wp_cli( $command ) {
- return __DIR__ . "/../../bin/wp $command";
+ return "wp $command";
}
// We cache the results of `wp core download` to improve test performance
2 => array( 'pipe', 'w' ),
);
- $proc = proc_open( $this->command, $descriptors, $pipes, $cwd );
+ // Ensure we're using the expected `wp` binary
+ $env = sprintf( 'function wp() { %s "$@"; }; %s',
+ realpath( __DIR__ . "/../../bin/wp" ), $this->command );
+
+ $wrapper = sprintf( 'bash -c %s', escapeshellarg( $env ) );
+
+ $proc = proc_open( $wrapper, $descriptors, $pipes, $cwd );
$STDOUT = stream_get_contents( $pipes[1] );
fclose( $pipes[1] );
Given a WP install
# Delete all users
- When I run `wp user list --format=ids`
- And save STDOUT as {USER_IDS}
- And I run `wp user delete {USER_IDS}`
+ When I run `wp user delete $(wp user list --format=ids)`
And I run `wp user list --format=ids`
Then STDOUT should be empty