@@ -234,8 +234,6 @@ public function testConfigureFileWithExistingMarks()
234
234
- db-data:/var/lib/postgresql/data:rw
235
235
# You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
236
236
# - ./docker/db/data:/var/lib/postgresql/data:rw
237
- ports:
238
- - "5432:5432"
239
237
###< doctrine/doctrine-bundle ###
240
238
241
239
volumes:
@@ -245,9 +243,6 @@ public function testConfigureFileWithExistingMarks()
245
243
246
244
YAML;
247
245
248
- $ recipe = $ this ->getMockBuilder (Recipe::class)->disableOriginalConstructor ()->getMock ();
249
- $ recipe ->method ('getName ' )->willReturn ('symfony/mercure-bundle ' );
250
-
251
246
$ dockerComposeFile = FLEX_TEST_DIR .'/docker-compose.yml ' ;
252
247
file_put_contents ($ dockerComposeFile , $ originalContent );
253
248
@@ -267,8 +262,6 @@ public function testConfigureFileWithExistingMarks()
267
262
' - CORS_ALLOWED_ORIGINS=* ' ,
268
263
' - PUBLISH_ALLOWED_ORIGINS=http://localhost:1337 ' ,
269
264
' - DEMO=1 ' ,
270
- ' ports: ' ,
271
- ' - "1337:80" ' ,
272
265
],
273
266
];
274
267
@@ -288,8 +281,6 @@ public function testConfigureFileWithExistingMarks()
288
281
- db-data:/var/lib/postgresql/data:rw
289
282
# You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
290
283
# - ./docker/db/data:/var/lib/postgresql/data:rw
291
- ports:
292
- - "5432:5432"
293
284
###< doctrine/doctrine-bundle ###
294
285
295
286
###> symfony/mercure-bundle ###
@@ -303,8 +294,6 @@ public function testConfigureFileWithExistingMarks()
303
294
- CORS_ALLOWED_ORIGINS=*
304
295
- PUBLISH_ALLOWED_ORIGINS=http://localhost:1337
305
296
- DEMO=1
306
- ports:
307
- - "1337:80"
308
297
###< symfony/mercure-bundle ###
309
298
310
299
volumes:
@@ -322,4 +311,76 @@ public function testConfigureFileWithExistingMarks()
322
311
$ this ->configurator ->unconfigure ($ this ->recipeDb , self ::CONFIG_DB , $ this ->lock );
323
312
$ this ->assertEquals (self ::ORIGINAL_CONTENT , file_get_contents ($ dockerComposeFile ));
324
313
}
314
+
315
+ public function testUnconfigureFileWithManyMarks ()
316
+ {
317
+ $ originalContent = self ::ORIGINAL_CONTENT .<<<'YAML'
318
+
319
+ ###> symfony/messenger ###
320
+ rabbitmq:
321
+ image: rabbitmq:management-alpine
322
+ environment:
323
+ # You should definitely change the password in production
324
+ - RABBITMQ_DEFAULT_USER=guest
325
+ - RABBITMQ_DEFAULT_PASS=guest
326
+ volumes:
327
+ - rabbitmq-data:/var/lib/rabbitmq
328
+ ###< symfony/messenger ###
329
+
330
+ ###> doctrine/doctrine-bundle ###
331
+ db:
332
+ image: postgres:11-alpine
333
+ environment:
334
+ - POSTGRES_DB=symfony
335
+ - POSTGRES_USER=symfony
336
+ # You should definitely change the password in production
337
+ - POSTGRES_PASSWORD=!ChangeMe!
338
+ volumes:
339
+ - db-data:/var/lib/postgresql/data:rw
340
+ # You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
341
+ # - ./docker/db/data:/var/lib/postgresql/data:rw
342
+ ###< doctrine/doctrine-bundle ###
343
+
344
+ volumes:
345
+ ###> symfony/messenger ###
346
+ rabbitmq-data: {}
347
+ ###< symfony/messenger ###
348
+
349
+ ###> doctrine/doctrine-bundle ###
350
+ db-data: {}
351
+ ###< doctrine/doctrine-bundle ###
352
+
353
+ YAML;
354
+
355
+ $ contentWithoutDoctrine = self ::ORIGINAL_CONTENT .<<<'YAML'
356
+
357
+ ###> symfony/messenger ###
358
+ rabbitmq:
359
+ image: rabbitmq:management-alpine
360
+ environment:
361
+ # You should definitely change the password in production
362
+ - RABBITMQ_DEFAULT_USER=guest
363
+ - RABBITMQ_DEFAULT_PASS=guest
364
+ volumes:
365
+ - rabbitmq-data:/var/lib/rabbitmq
366
+ ###< symfony/messenger ###
367
+
368
+ volumes:
369
+ ###> symfony/messenger ###
370
+ rabbitmq-data: {}
371
+ ###< symfony/messenger ###
372
+
373
+
374
+ YAML;
375
+
376
+ $ dockerComposeFile = FLEX_TEST_DIR .'/docker-compose.yml ' ;
377
+ file_put_contents ($ dockerComposeFile , $ originalContent );
378
+
379
+ /** @var Recipe|\PHPUnit\Framework\MockObject\MockObject $recipe */
380
+ $ recipe = $ this ->getMockBuilder (Recipe::class)->disableOriginalConstructor ()->getMock ();
381
+ $ recipe ->method ('getName ' )->willReturn ('symfony/messenger ' );
382
+
383
+ $ this ->configurator ->unconfigure ($ this ->recipeDb , self ::CONFIG_DB , $ this ->lock );
384
+ $ this ->assertEquals ($ contentWithoutDoctrine , file_get_contents ($ dockerComposeFile ));
385
+ }
325
386
}
0 commit comments