Skip to content
Snippets Groups Projects
Commit 2318ad9c authored by catch's avatar catch
Browse files

Issue #3281193 by neclimdul: Improve GenerateThemeTest

(cherry picked from commit e73abb21)
parent fedb23d3
No related branches found
No related tags found
No related merge requests found
......@@ -45,7 +45,7 @@ public function setUp(): void {
* @return \Symfony\Component\Process\Process
* The PHP process
*/
private function generateThemeFromStarterkit() : Process {
private function generateThemeFromStarterkit($env = NULL) : Process {
$install_command = [
$this->php,
'core/scripts/drupal',
......@@ -54,7 +54,7 @@ private function generateThemeFromStarterkit() : Process {
'--name="Test custom starterkit theme"',
'--description="Custom theme generated from a starterkit theme"',
];
$process = new Process($install_command, NULL);
$process = new Process($install_command, NULL, $env);
$process->setTimeout(60);
return $process;
}
......@@ -262,20 +262,23 @@ public function testContribStarterkitDevSnapshotWithGitNotInstalled(): void {
SH;
file_put_contents($unavailableGitPath . '/git', $bash);
chmod($unavailableGitPath . '/git', 0755);
$oldPath = getenv('PATH');
putenv('PATH=' . $unavailableGitPath . ':' . getenv('PATH'));
// Confirm that 'git' is no longer available.
$output = [];
exec('git --help', $output, $status);
$this->assertEquals(127, $status);
$process = $this->generateThemeFromStarterkit();
$env = [
'PATH' => $unavailableGitPath . ':' . getenv('PATH'),
'COLUMNS' => 80,
];
$process = new Process([
'git',
'--help',
], NULL, $env);
$process->run();
$this->assertEquals(127, $process->getExitCode(), 'Fake git used by process.');
$process = $this->generateThemeFromStarterkit($env);
$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->getOutput()), $process->getErrorOutput());
$this->assertSame(1, $result);
$this->assertFileDoesNotExist($this->getWorkspaceDirectory() . "/themes/test_custom_theme");
putenv('PATH=' . $oldPath . ':' . getenv('PATH'));
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment