Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Console/Commands/PublishDockerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function handle(): int

if ($ssl !== null && $ssl !== '' && ! filter_var($ssl, FILTER_VALIDATE_BOOLEAN)) {
if (! copy($stubs.'/docker/nginx-no-ssl.conf', $base.'/docker/nginx.conf')) {
$this->warn('Failed to write nginx.conf (no-SSL).');
$this->warn('Failed to write nginx.conf (no-SSL). Check that Docker stubs were published first.');
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/Environments/DockerEnvironment.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,12 @@ protected function publishStubs(InstallCommand $command): void
{
$command->info('Publishing Docker stubs...');

// Non-interactive: existing files are kept (the confirm defaults to "no").
// Forced non-interactive so existing files are kept silently, as the
// install flow has always done — never prompt to overwrite here.
$command->call('docker:publish', [
'--path' => $command->path(),
'--ssl' => $this->ssl ? 'yes' : 'no',
'--no-interaction' => true,
]);
}

Expand Down
36 changes: 36 additions & 0 deletions tests/Feature/Environments/DockerEnvironmentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1348,6 +1348,42 @@ public function resolveModules(InstallCommand $command): array

return $exposed->resolveModules($command);
}

// -------------------------------------------------------------------------
// publishStubs
// -------------------------------------------------------------------------

public function test_publish_stubs_delegates_non_interactively_so_existing_files_are_never_prompted(): void
{
$env = new class extends DockerEnvironment
{
public function publish(InstallCommand $command): void
{
$this->ssl = false;
$this->publishStubs($command);
}
};

$command = new class(null, [], ['path' => '/tmp/app']) extends FakeInstallCommand
{
/** @var array<string, mixed> */
public array $calledWith = [];

public function call($command, array $arguments = [])
{
$this->calledWith = ['command' => $command] + $arguments;

return 0;
}
};

$env->publish($command);

$this->assertSame('docker:publish', $command->calledWith['command']);
$this->assertSame('/tmp/app', $command->calledWith['--path']);
$this->assertSame('no', $command->calledWith['--ssl']);
$this->assertTrue($command->calledWith['--no-interaction'], 'install must never prompt to overwrite Docker files');
}
}

/**
Expand Down