diff --git a/src/Configurator/DockerComposeConfigurator.php b/src/Configurator/DockerComposeConfigurator.php index 1f7589f22..42bdda92b 100644 --- a/src/Configurator/DockerComposeConfigurator.php +++ b/src/Configurator/DockerComposeConfigurator.php @@ -236,7 +236,7 @@ private function configureDockerCompose(Recipe $recipe, array $config, bool $upd $dockerComposeFile = $this->findDockerComposeFile($rootDir, $file); if (null === $dockerComposeFile) { $dockerComposeFile = $rootDir.'/'.$file; - file_put_contents($dockerComposeFile, "version: '3'\n"); + file_put_contents($dockerComposeFile, ''); $this->write(sprintf(' Created "%s"', $file)); } diff --git a/tests/Configurator/DockerComposeConfiguratorTest.php b/tests/Configurator/DockerComposeConfiguratorTest.php index 114249dad..ec3bedd9f 100644 --- a/tests/Configurator/DockerComposeConfiguratorTest.php +++ b/tests/Configurator/DockerComposeConfiguratorTest.php @@ -28,8 +28,6 @@ class DockerComposeConfiguratorTest extends TestCase { public const ORIGINAL_CONTENT = <<<'YAML' -version: '3.4' - services: app: build: @@ -640,11 +638,10 @@ public function testConfigureFileInParentDir() public function testConfigureWithoutExistingDockerComposeFiles() { $dockerComposeFile = FLEX_TEST_DIR.'/compose.yaml'; - $defaultContent = "version: '3'\n"; $this->configurator->configure($this->recipeDb, self::CONFIG_DB, $this->lock); - $this->assertStringEqualsFile($dockerComposeFile, $defaultContent.<<<'YAML' + $this->assertStringEqualsFile($dockerComposeFile, <<<'YAML' services: ###> doctrine/doctrine-bundle ### @@ -671,7 +668,7 @@ public function testConfigureWithoutExistingDockerComposeFiles() ); $this->configurator->unconfigure($this->recipeDb, self::CONFIG_DB, $this->lock); - $this->assertEquals(trim($defaultContent), file_get_contents($dockerComposeFile)); + $this->assertEquals('', file_get_contents($dockerComposeFile)); } public function testUpdate() @@ -691,8 +688,6 @@ public function testUpdate() file_put_contents( FLEX_TEST_DIR.'/docker-compose.yml', << doctrine/doctrine-bundle ### database: @@ -768,8 +763,6 @@ public function testUpdate() ); $this->assertSame(['docker-compose.yml' => << doctrine/doctrine-bundle ### database: @@ -807,8 +800,6 @@ public function testUpdate() ], $recipeUpdate->getOriginalFiles()); $this->assertSame(['docker-compose.yml' => << doctrine/doctrine-bundle ### database: