Skip to content

Commit

Permalink
Merge branch '7.x' into 8.x
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <[email protected]>
  • Loading branch information
crynobone committed Dec 9, 2024
2 parents 5c14acc + 4d09a3f commit bdde1b2
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/Console/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,15 @@ protected function copyTestbenchDotEnvFile(Filesystem $filesystem, string $worki
return;
}

/** @var string $targetEnvironmentFile */
$targetEnvironmentFile = select(
label: "Export '.env' file as?",
options: $choices->prepend('Skip exporting .env'), // @phpstan-ignore argument.type
default: 'Skip exporting .env'
);

if ($targetEnvironmentFile === 'Skip exporting .env') {
/** @var string|null $targetEnvironmentFile */
$targetEnvironmentFile = $this->input->isInteractive()
? select(
label: "Export '.env' file as?",
options: $choices->prepend('Skip exporting .env'), // @phpstan-ignore argument.type
default: 'Skip exporting .env'
) : null;

if (\in_array($targetEnvironmentFile, [null, 'Skip exporting .env'])) {
return;
}

Expand Down
10 changes: 10 additions & 0 deletions tests/Console/DevToolCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,14 @@ public function it_can_run_devtool_command_without_installation()
$this->assertCommandExecutedWithDevTool();
$this->assertCommandExecutedWithoutInstall();
}

#[Test]
public function it_can_be_installed_with_no_interaction_options()
{
$this->artisan('workbench:devtool', ['--no-install' => true, '--no-interaction' => true])
->assertSuccessful();

$this->assertCommandExecutedWithDevTool();
$this->assertCommandExecutedWithoutInstall();
}
}
10 changes: 10 additions & 0 deletions tests/Console/InstallCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,14 @@ public function it_can_ignore_generating_environment_file_if_it_already_exists()
$this->assertCommandExecutedWithBasicInstall();
$this->assertCommandExecutedWithoutDevTool();
}

#[Test]
public function it_can_be_installed_with_no_interaction_options()
{
$this->artisan('workbench:install', ['--basic' => true, '--no-devtool' => true, '--no-interaction' => true])
->assertSuccessful();

$this->assertCommandExecutedWithBasicInstall();
$this->assertCommandExecutedWithoutDevTool();
}
}

0 comments on commit bdde1b2

Please sign in to comment.