Skip to content

Commit 530491f

Browse files
committed
another phpunit attempt
1 parent 6ce7eef commit 530491f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tests/tests/TestBehatTags.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ private function run_behat_tags_script( $env = '' ) {
5353
if ( DIRECTORY_SEPARATOR === '\\' ) { // Windows
5454
// `set` is internal to `cmd.exe`. Do not escape the $env variable, as it's from a trusted
5555
// data provider and `escapeshellarg` adds quotes that `set` doesn't understand.
56-
$command = 'set ' . $env . ' && ';
56+
// Note: `set "VAR=VALUE"` is more robust than `set VAR=VALUE`.
57+
$command = 'set "' . $env . '" && ';
5758
} else {
5859
// On Unix-like systems, this sets the variable for the duration of the command.
5960
$command = $env . ' ';
@@ -226,11 +227,11 @@ public function test_behat_tags_extension(): void {
226227
}
227228

228229
// Check which extensions are loaded in the clean `php -n` environment to build the correct expectation.
229-
$imagick_loaded_in_script = (bool) exec( escapeshellarg( PHP_BINARY ) . ' -n -r "echo (int)extension_loaded(\'imagick\');"' );
230+
$imagick_loaded_in_script = (bool) exec( 'cd ' . escapeshellarg( $this->temp_dir ) . ' && ' . escapeshellarg( PHP_BINARY ) . ' -n -r "echo (int)extension_loaded(\'imagick\');"' );
230231
if ( ! $imagick_loaded_in_script ) {
231232
$expecteds[] = '~@require-extension-imagick';
232233
}
233-
$curl_loaded_in_script = (bool) exec( escapeshellarg( PHP_BINARY ) . ' -n -r "echo (int)extension_loaded(\'curl\');"' );
234+
$curl_loaded_in_script = (bool) exec( 'cd ' . escapeshellarg( $this->temp_dir ) . ' && ' . escapeshellarg( PHP_BINARY ) . ' -n -r "echo (int)extension_loaded(\'curl\');"' );
234235
if ( ! $curl_loaded_in_script ) {
235236
$expecteds[] = '~@require-extension-curl';
236237
}

0 commit comments

Comments
 (0)