diff --git a/src/Configurator/DockerComposeConfigurator.php b/src/Configurator/DockerComposeConfigurator.php index 84b8afd2..c1f67721 100644 --- a/src/Configurator/DockerComposeConfigurator.php +++ b/src/Configurator/DockerComposeConfigurator.php @@ -48,7 +48,7 @@ public function configure(Recipe $recipe, $config, Lock $lock, array $options = $this->configureDockerCompose($recipe, $config, $options['force'] ?? false); - $this->write('Docker Compose definitions have been modified. Please run "docker compose up --build" again to apply the changes.'); + $this->write('Docker Compose definitions have been modified. Please run "docker compose up --build" again to apply the changes.', IOInterface::NORMAL); } public function unconfigure(Recipe $recipe, $config, Lock $lock) @@ -76,7 +76,7 @@ public function unconfigure(Recipe $recipe, $config, Lock $lock) file_put_contents($dockerComposeFile, ltrim($contents, "\n")); } - $this->write('Docker Compose definitions have been modified. Please run "docker compose up" again to apply the changes.'); + $this->write('Docker Compose definitions have been modified. Please run "docker compose up" again to apply the changes.', IOInterface::NORMAL); } public function update(RecipeUpdate $recipeUpdate, array $originalConfig, array $newConfig): void diff --git a/tests/Configurator/DockerComposeConfiguratorTest.php b/tests/Configurator/DockerComposeConfiguratorTest.php index efaa9f32..e818d05d 100644 --- a/tests/Configurator/DockerComposeConfiguratorTest.php +++ b/tests/Configurator/DockerComposeConfiguratorTest.php @@ -209,6 +209,43 @@ public function testConfigure(string $fileName) $this->assertEquals(self::ORIGINAL_CONTENT, file_get_contents($dockerComposeFile)); } + public function testTheDockerComposeInstructionsAreNotHiddenBehindVerboseMode() + { + $dockerComposeFile = FLEX_TEST_DIR.'/compose.yaml'; + file_put_contents($dockerComposeFile, self::ORIGINAL_CONTENT); + + $messages = []; + $io = $this->createStub(IOInterface::class); + $io->method('writeError')->willReturnCallback( + static function ($message, $newline = true, $verbosity = IOInterface::NORMAL) use (&$messages) { + foreach ((array) $message as $line) { + $messages[] = [trim($line), $verbosity]; + } + } + ); + + $configurator = new DockerComposeConfigurator( + $this->composer, + $io, + new Options(['config-dir' => 'config', 'root-dir' => FLEX_TEST_DIR]) + ); + + $configurator->configure($this->recipeDb, self::CONFIG_DB, $this->lock); + + $this->assertContains( + ['Docker Compose definitions have been modified. Please run "docker compose up --build" again to apply the changes.', IOInterface::NORMAL], + $messages + ); + + $messages = []; + $configurator->unconfigure($this->recipeDb, self::CONFIG_DB, $this->lock); + + $this->assertContains( + ['Docker Compose definitions have been modified. Please run "docker compose up" again to apply the changes.', IOInterface::NORMAL], + $messages + ); + } + public function testReconfigureDoesNotDuplicateLaterTopLevelKey() { $this->configurator->configure($this->recipeDb, self::CONFIG_DB, $this->lock);