Issue #3447198 by phenaproxima, alexpott, nicxvan, larowlan: RecipeCommand mistakenly tries to apply a recipe even if you don't give it a valid directory
(cherry picked from commit 389c2bee0b
)
merge-requests/8129/head
parent
a81b9fc443
commit
58cd9ce083
|
@ -65,6 +65,7 @@ final class RecipeCommand extends Command {
|
|||
$recipe_path = $input->getArgument('path');
|
||||
if (!is_string($recipe_path) || !is_dir($recipe_path)) {
|
||||
$io->error(sprintf('The supplied path %s is not a directory', $recipe_path));
|
||||
return 1;
|
||||
}
|
||||
// Recipes can only be applied to an already-installed site.
|
||||
$container = $this->boot()->getContainer();
|
||||
|
|
|
@ -91,6 +91,18 @@ class RecipeCommandTest extends BrowserTestBase {
|
|||
$this->assertStringContainsString('There were validation errors in system.image:', $process->getErrorOutput());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the recipe command with a non-existent directory.
|
||||
*/
|
||||
public function testErrorOnNonExistentDirectory(): void {
|
||||
$process = $this->applyRecipe('core/tests/fixtures/recipes/does_not_exist', 1);
|
||||
|
||||
// The directory error should be the only error visible.
|
||||
$output = trim(preg_replace('/\s+/', ' ', $process->getOutput()));
|
||||
$this->assertSame('[ERROR] The supplied path core/tests/fixtures/recipes/does_not_exist is not a directory', $output);
|
||||
$this->assertEmpty($process->getErrorOutput());
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the current set of checkpoints matches the given labels.
|
||||
*
|
||||
|
|
|
@ -58,7 +58,6 @@ trait RecipeTestTrait {
|
|||
*/
|
||||
protected function applyRecipe(string $path, int $expected_exit_code = 0): Process {
|
||||
assert($this instanceof BrowserTestBase);
|
||||
$this->assertDirectoryExists($path);
|
||||
|
||||
$arguments = [
|
||||
(new PhpExecutableFinder())->find(),
|
||||
|
|
Loading…
Reference in New Issue