Skip to content
Open
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
4 changes: 2 additions & 2 deletions src/Configurator/DockerComposeConfigurator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
37 changes: 37 additions & 0 deletions tests/Configurator/DockerComposeConfiguratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading