Skip to content

Commit 6f1fdab

Browse files
committed
AI-suggested fix
1 parent bc16f04 commit 6f1fdab

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

tests/tests/TestBehatTags.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,8 @@ protected function tear_down(): void {
4444
private function run_behat_tags_script( $env = '' ) {
4545
$behat_tags = dirname( dirname( __DIR__ ) ) . '/utils/behat-tags.php';
4646

47-
// Get the loaded ini file from the current process to ensure config consistency.
48-
$ini_file = php_ini_loaded_file();
49-
$ini_arg = $ini_file ? ' -c ' . escapeshellarg( $ini_file ) : '';
50-
51-
// Use the same PHP binary that is running the tests.
52-
$php_run = escapeshellarg( PHP_BINARY ) . $ini_arg . ' ' . escapeshellarg( $behat_tags );
47+
// Use the `-n` flag to disable loading of `php.ini` and ensure a clean environment.
48+
$php_run = escapeshellarg( PHP_BINARY ) . ' -n ' . escapeshellarg( $behat_tags );
5349

5450
$command = '';
5551
if ( ! empty( $env ) ) {
@@ -65,7 +61,6 @@ private function run_behat_tags_script( $env = '' ) {
6561
}
6662

6763
$command = 'cd ' . escapeshellarg( $this->temp_dir ) . ' && ' . $command . $php_run;
68-
echo "Executing Command: {$command}\n";
6964
$output = exec( $command );
7065

7166
return $output;
@@ -239,9 +234,6 @@ public function test_behat_tags_extension(): void {
239234

240235
$expected = '--tags=' . implode( '&&', array_merge( array( '~@github-api', '~@broken' ), $expecteds ) );
241236
$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";
245237
$this->assertSame( $expected, $output );
246238

247239
putenv( false === $env_github_token ? 'GITHUB_TOKEN' : "GITHUB_TOKEN=$env_github_token" );

0 commit comments

Comments
 (0)