diff --git a/core/tests/Drupal/BuildTests/Command/GenerateThemeTest.php b/core/tests/Drupal/BuildTests/Command/GenerateThemeTest.php index 930f07e7edc1ed90b7819ff1de4d3e62025de8e7..e4f7c40f2005e4f5a63a945d37a1411aeff24a5c 100644 --- a/core/tests/Drupal/BuildTests/Command/GenerateThemeTest.php +++ b/core/tests/Drupal/BuildTests/Command/GenerateThemeTest.php @@ -270,6 +270,7 @@ public function testContribStarterkitDevSnapshotWithGitNotInstalled(): void { // not found. Note that we run our tests using process isolation, so we do // not need to restore the PATH when we are done. $unavailableGitPath = $this->getWorkspaceDirectory() . '/bin'; + putenv('PATH=' . $unavailableGitPath . ':' . getenv('PATH')); mkdir($unavailableGitPath); $bash = <<<SH #!/bin/bash @@ -279,18 +280,14 @@ public function testContribStarterkitDevSnapshotWithGitNotInstalled(): void { file_put_contents($unavailableGitPath . '/git', $bash); chmod($unavailableGitPath . '/git', 0755); // Confirm that 'git' is no longer available. - $env = [ - 'PATH' => $unavailableGitPath . ':' . getenv('PATH'), - 'COLUMNS' => 80, - ]; - $process = new Process([ - 'git', - '--help', - ], NULL, $env); + $process = new Process(['git', '--help']); $process->run(); $this->assertEquals(127, $process->getExitCode(), 'Fake git used by process.'); - $process = $this->generateThemeFromStarterkit($env); + $process = $this->generateThemeFromStarterkit([ + 'PATH' => getenv('PATH'), + 'COLUMNS' => 80, + ]); $result = $process->run(); $this->assertEquals("[ERROR] The source theme starterkit_theme has a development version number \n (7.x-dev). Determining a specific commit is not possible because git is\n not installed. Either install git or use a tagged release to generate a\n theme.", trim($process->getErrorOutput()), $process->getErrorOutput()); $this->assertSame(1, $result);