23
23
use Symfony \Flex \Update \RecipeUpdate ;
24
24
25
25
/**
26
- * @author Kévin Dunglas <[email protected] >
26
+ * @author Kévin Dunglas <[email protected] >
27
27
*/
28
28
class DockerComposeConfiguratorTest extends TestCase
29
29
{
@@ -166,18 +166,33 @@ protected function tearDown(): void
166
166
putenv ('COMPOSER= ' .$ this ->originalEnvComposer );
167
167
168
168
(new Filesystem ())->remove ([
169
+ FLEX_TEST_DIR .'/compose.yml ' ,
169
170
FLEX_TEST_DIR .'/docker-compose.yml ' ,
171
+ FLEX_TEST_DIR .'/compose.override.yml ' ,
170
172
FLEX_TEST_DIR .'/docker-compose.override.yml ' ,
173
+ FLEX_TEST_DIR .'/compose.yaml ' ,
171
174
FLEX_TEST_DIR .'/docker-compose.yaml ' ,
172
175
FLEX_TEST_DIR .'/composer.json ' ,
176
+ FLEX_TEST_DIR .'/child/compose.override.yaml ' ,
173
177
FLEX_TEST_DIR .'/child/docker-compose.override.yaml ' ,
174
178
FLEX_TEST_DIR .'/child ' ,
175
179
]);
176
180
}
177
181
178
- public function testConfigure ()
182
+ public static function dockerComposerFileProvider (): iterable
179
183
{
180
- $ dockerComposeFile = FLEX_TEST_DIR .'/docker-compose.yaml ' ;
184
+ yield ['compose.yaml ' ];
185
+ yield ['compose.yml ' ];
186
+ yield ['docker-compose.yaml ' ];
187
+ yield ['docker-compose.yml ' ];
188
+ }
189
+
190
+ /**
191
+ * @dataProvider dockerComposerFileProvider
192
+ */
193
+ public function testConfigure (string $ fileName )
194
+ {
195
+ $ dockerComposeFile = FLEX_TEST_DIR ."/ $ fileName " ;
181
196
file_put_contents ($ dockerComposeFile , self ::ORIGINAL_CONTENT );
182
197
183
198
$ this ->configurator ->configure ($ this ->recipeDb , self ::CONFIG_DB , $ this ->lock );
@@ -216,7 +231,7 @@ public function testNotConfiguredIfConfigSet()
216
231
$ this ->package ->setExtra (['symfony ' => ['docker ' => false ]]);
217
232
$ this ->configurator ->configure ($ this ->recipeDb , self ::CONFIG_DB , $ this ->lock );
218
233
219
- $ this ->assertFileDoesNotExist (FLEX_TEST_DIR .'/docker-compose.yml ' );
234
+ $ this ->assertFileDoesNotExist (FLEX_TEST_DIR .'/docker-compose.yaml ' );
220
235
}
221
236
222
237
/**
@@ -235,9 +250,9 @@ public function testPreferenceAskedInteractively(string $userInput, bool $expect
235
250
$ this ->configurator ->configure ($ this ->recipeDb , self ::CONFIG_DB , $ this ->lock );
236
251
237
252
if ($ expectedIsConfigured ) {
238
- $ this ->assertFileExists (FLEX_TEST_DIR .'/docker- compose.yml ' );
253
+ $ this ->assertFileExists (FLEX_TEST_DIR .'/compose.yaml ' );
239
254
} else {
240
- $ this ->assertFileDoesNotExist (FLEX_TEST_DIR .'/docker- compose.yml ' );
255
+ $ this ->assertFileDoesNotExist (FLEX_TEST_DIR .'/compose.yaml ' );
241
256
}
242
257
243
258
$ composerJsonData = json_decode (file_get_contents ($ composerJsonPath ), true );
@@ -270,7 +285,7 @@ public function testEnvVarUsedForDockerConfirmation()
270
285
$ this ->configurator ->configure ($ this ->recipeDb , self ::CONFIG_DB , $ this ->lock );
271
286
unset($ _SERVER ['SYMFONY_DOCKER ' ]);
272
287
273
- $ this ->assertFileExists (FLEX_TEST_DIR .'/docker- compose.yml ' );
288
+ $ this ->assertFileExists (FLEX_TEST_DIR .'/compose.yaml ' );
274
289
275
290
$ composerJsonData = json_decode (file_get_contents ($ composerJsonPath ), true );
276
291
$ this ->assertArrayHasKey ('extra ' , $ composerJsonData );
@@ -624,7 +639,7 @@ public function testConfigureFileInParentDir()
624
639
625
640
public function testConfigureWithoutExistingDockerComposeFiles ()
626
641
{
627
- $ dockerComposeFile = FLEX_TEST_DIR .'/docker- compose.yml ' ;
642
+ $ dockerComposeFile = FLEX_TEST_DIR .'/compose.yaml ' ;
628
643
$ defaultContent = "version: '3' \n" ;
629
644
630
645
$ this ->configurator ->configure ($ this ->recipeDb , self ::CONFIG_DB , $ this ->lock );
0 commit comments