Skip to content

Commit 33ce7c1

Browse files
committed
Remove version in generated Docker compose files
1 parent 2081076 commit 33ce7c1

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

src/Configurator/DockerComposeConfigurator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ private function configureDockerCompose(Recipe $recipe, array $config, bool $upd
236236
$dockerComposeFile = $this->findDockerComposeFile($rootDir, $file);
237237
if (null === $dockerComposeFile) {
238238
$dockerComposeFile = $rootDir.'/'.$file;
239-
file_put_contents($dockerComposeFile, "version: '3'\n");
239+
file_put_contents($dockerComposeFile, '');
240240
$this->write(sprintf(' Created <fg=green>"%s"</>', $file));
241241
}
242242

tests/Configurator/DockerComposeConfiguratorTest.php

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
class DockerComposeConfiguratorTest extends TestCase
2929
{
3030
public const ORIGINAL_CONTENT = <<<'YAML'
31-
version: '3.4'
32-
3331
services:
3432
app:
3533
build:
@@ -640,11 +638,10 @@ public function testConfigureFileInParentDir()
640638
public function testConfigureWithoutExistingDockerComposeFiles()
641639
{
642640
$dockerComposeFile = FLEX_TEST_DIR.'/compose.yaml';
643-
$defaultContent = "version: '3'\n";
644641

645642
$this->configurator->configure($this->recipeDb, self::CONFIG_DB, $this->lock);
646643

647-
$this->assertStringEqualsFile($dockerComposeFile, $defaultContent.<<<'YAML'
644+
$this->assertStringEqualsFile($dockerComposeFile, <<<'YAML'
648645
649646
services:
650647
###> doctrine/doctrine-bundle ###
@@ -671,7 +668,7 @@ public function testConfigureWithoutExistingDockerComposeFiles()
671668
);
672669

673670
$this->configurator->unconfigure($this->recipeDb, self::CONFIG_DB, $this->lock);
674-
$this->assertEquals(trim($defaultContent), file_get_contents($dockerComposeFile));
671+
$this->assertEquals('', file_get_contents($dockerComposeFile));
675672
}
676673

677674
public function testUpdate()
@@ -691,8 +688,6 @@ public function testUpdate()
691688
file_put_contents(
692689
FLEX_TEST_DIR.'/docker-compose.yml',
693690
<<<EOF
694-
version: '3'
695-
696691
services:
697692
###> doctrine/doctrine-bundle ###
698693
database:
@@ -768,8 +763,6 @@ public function testUpdate()
768763
);
769764

770765
$this->assertSame(['docker-compose.yml' => <<<EOF
771-
version: '3'
772-
773766
services:
774767
###> doctrine/doctrine-bundle ###
775768
database:
@@ -807,8 +800,6 @@ public function testUpdate()
807800
], $recipeUpdate->getOriginalFiles());
808801

809802
$this->assertSame(['docker-compose.yml' => <<<EOF
810-
version: '3'
811-
812803
services:
813804
###> doctrine/doctrine-bundle ###
814805
database:

0 commit comments

Comments
 (0)