diff --git a/src/Console/Commands/PublishDockerCommand.php b/src/Console/Commands/PublishDockerCommand.php index 8a14767..e2e6a19 100644 --- a/src/Console/Commands/PublishDockerCommand.php +++ b/src/Console/Commands/PublishDockerCommand.php @@ -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.'); } } diff --git a/src/Environments/DockerEnvironment.php b/src/Environments/DockerEnvironment.php index 3db065d..d310b6d 100644 --- a/src/Environments/DockerEnvironment.php +++ b/src/Environments/DockerEnvironment.php @@ -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, ]); } diff --git a/tests/Feature/Environments/DockerEnvironmentTest.php b/tests/Feature/Environments/DockerEnvironmentTest.php index 14f68d1..c19b4c6 100644 --- a/tests/Feature/Environments/DockerEnvironmentTest.php +++ b/tests/Feature/Environments/DockerEnvironmentTest.php @@ -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 */ + 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'); + } } /**