@@ -53,18 +53,19 @@ private function run_behat_tags_script( $env = '' ) {
5353
5454 $ command = '' ;
5555 if ( ! empty ( $ env ) ) {
56- // putenv() can be unreliable, especially on Windows.
57- // Prepending the variable to the command is a more robust cross-platform solution.
56+ // putenv() can be unreliable. Prepending the variable to the command is more robust.
5857 if ( DIRECTORY_SEPARATOR === '\\' ) { // Windows
59- // Note: `set` is internal to `cmd.exe` and works on the subsequent command after `&&`.
60- $ command = 'set ' . escapeshellarg ( $ env ) . ' && ' ;
58+ // `set` is internal to `cmd.exe`. Do not escape the $env variable, as it's from a trusted
59+ // data provider and `escapeshellarg` adds quotes that `set` doesn't understand.
60+ $ command = 'set ' . $ env . ' && ' ;
6161 } else {
6262 // On Unix-like systems, this sets the variable for the duration of the command.
6363 $ command = $ env . ' ' ;
6464 }
6565 }
6666
6767 $ command = 'cd ' . escapeshellarg ( $ this ->temp_dir ) . ' && ' . $ command . $ php_run ;
68+ echo "Executing Command: {$ command }\n" ;
6869 $ output = exec ( $ command );
6970
7071 return $ output ;
@@ -238,6 +239,9 @@ public function test_behat_tags_extension(): void {
238239
239240 $ expected = '--tags= ' . implode ( '&& ' , array_merge ( array ( '~@github-api ' , '~@broken ' ), $ expecteds ) );
240241 $ output = $ this ->run_behat_tags_script ();
242+ echo "Imagick Loaded in Test: " . ( extension_loaded ( 'imagick ' ) ? 'Yes ' : 'No ' ) . "\n" ;
243+ echo "Expected: {$ expected }\n" ;
244+ echo "Actual: {$ output }\n" ;
241245 $ this ->assertSame ( $ expected , $ output );
242246
243247 putenv ( false === $ env_github_token ? 'GITHUB_TOKEN ' : "GITHUB_TOKEN= $ env_github_token " );
0 commit comments