Skip to content

Commit 2e886a5

Browse files
authored
Support nested variables in INVOKE_WP_CLI_WITH_PHP_ARGS (#294)
1 parent 53d9dbd commit 2e886a5

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

features/steps.feature

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ Feature: Make sure "Given", "When", "Then" steps work as expected
6868
Then STDOUT should match /\d\.\d/
6969
And STDERR should be empty
7070

71+
Scenario: Nested special variables
72+
Given an empty directory
73+
When I run `echo {INVOKE_WP_CLI_WITH_PHP_ARGS--dopen_basedir={RUN_DIR}} cli info`
74+
Then STDOUT should match /^WP_CLI_PHP_ARGS=-dopen_basedir=.* ?wp cli info/
75+
And STDERR should be empty
76+
7177
@require-mysql-or-mariadb
7278
Scenario: SQL related variables
7379
When I run `echo {MYSQL_BINARY}`

src/Context/FeatureContext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,7 @@ private function replace_invoke_wp_cli_with_php_args( $str ) {
980980
}
981981

982982
$str = preg_replace_callback(
983-
'/{INVOKE_WP_CLI_WITH_PHP_ARGS-([^}]*)}/',
983+
'/{INVOKE_WP_CLI_WITH_PHP_ARGS-(.*)}/',
984984
static function ( $matches ) use ( $phar_path, $shell_path ) {
985985
return $phar_path ? "php {$matches[1]} {$phar_path}" : ( 'WP_CLI_PHP_ARGS=' . escapeshellarg( $matches[1] ) . ' ' . $shell_path );
986986
},

0 commit comments

Comments
 (0)