Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions features/steps.feature
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ Feature: Make sure "Given", "When", "Then" steps work as expected
Then STDOUT should match /^WP_CLI_PHP_ARGS=-dopen_basedir=.* ?wp cli info/
And STDERR should be empty

When I run `echo {INVOKE_WP_CLI_WITH_PHP_ARGS--dopen_basedir={RUN_DIR}} eval 'echo "{RUN_DIR}";'`
Then STDOUT should match /^WP_CLI_PHP_ARGS=-dopen_basedir=(.*)(.*) ?wp eval echo "\1";/

@require-mysql-or-mariadb
Scenario: SQL related variables
When I run `echo {MYSQL_BINARY}`
Expand Down
4 changes: 2 additions & 2 deletions src/Context/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ private static function terminate_proc( $master_pid ): void {

$output = shell_exec( "ps -o ppid,pid,command | grep $master_pid" );

foreach ( explode( PHP_EOL, $output ) as $line ) {
foreach ( explode( PHP_EOL, $output ? $output : '' ) as $line ) {
if ( preg_match( '/^\s*(\d+)\s+(\d+)/', $line, $matches ) ) {
$parent = $matches[1];
$child = $matches[2];
Expand Down Expand Up @@ -939,10 +939,10 @@ protected static function bootstrap_feature_context(): void {
* @return string
*/
public function replace_variables( $str ) {
$str = preg_replace_callback( '/\{([A-Z_][A-Z_0-9]*)\}/', [ $this, 'replace_var' ], $str );
if ( false !== strpos( $str, '{INVOKE_WP_CLI_WITH_PHP_ARGS-' ) ) {
$str = $this->replace_invoke_wp_cli_with_php_args( $str );
}
$str = preg_replace_callback( '/\{([A-Z_][A-Z_0-9]*)\}/', [ $this, 'replace_var' ], $str );
if ( false !== strpos( $str, '{WP_VERSION-' ) ) {
$str = $this->replace_wp_versions( $str );
}
Expand Down