@@ -501,7 +501,7 @@ public function testDecoratedServicesWithWrongSyntaxThrowsException()
501
501
502
502
/**
503
503
* @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
504
- * @expectedExceptionMessage Parameter "tags" must be an array for service "Foo\Bar" in services31_invalid_tags.yml. Check your YAML syntax.
504
+ * @expectedExceptionMessageRegExp / Parameter "tags" must be an array for service "Foo\\ Bar" in .+ services31_invalid_tags\ .yml\ . Check your YAML syntax./
505
505
*/
506
506
public function testInvalidTagsWithDefaults ()
507
507
{
@@ -534,7 +534,7 @@ public function testAnonymousServices()
534
534
$ this ->assertCount (1 , $ args );
535
535
$ this ->assertInstanceOf (Reference::class, $ args [0 ]);
536
536
$ this ->assertTrue ($ container ->has ((string ) $ args [0 ]));
537
- $ this ->assertStringStartsWith ( ' 2 ' , (string ) $ args [0 ]);
537
+ $ this ->assertRegExp ( ' /^\d+_[A-Za-z0-9]{64}$/ ' , (string ) $ args [0 ]);
538
538
539
539
$ anonymous = $ container ->getDefinition ((string ) $ args [0 ]);
540
540
$ this ->assertEquals ('Bar ' , $ anonymous ->getClass ());
@@ -546,7 +546,7 @@ public function testAnonymousServices()
546
546
$ this ->assertInternalType ('array ' , $ factory );
547
547
$ this ->assertInstanceOf (Reference::class, $ factory [0 ]);
548
548
$ this ->assertTrue ($ container ->has ((string ) $ factory [0 ]));
549
- $ this ->assertStringStartsWith ( ' 1 ' , (string ) $ factory [0 ]);
549
+ $ this ->assertRegExp ( ' /^\d+_[A-Za-z0-9]{64}$/ ' , (string ) $ factory [0 ]);
550
550
$ this ->assertEquals ('constructFoo ' , $ factory [1 ]);
551
551
552
552
$ anonymous = $ container ->getDefinition ((string ) $ factory [0 ]);
@@ -555,6 +555,19 @@ public function testAnonymousServices()
555
555
$ this ->assertFalse ($ anonymous ->isAutowired ());
556
556
}
557
557
558
+ public function testAnonymousServicesInDifferentFilesWithSameNameDoNotConflict ()
559
+ {
560
+ $ container = new ContainerBuilder ();
561
+
562
+ $ loader = new YamlFileLoader ($ container , new FileLocator (self ::$ fixturesPath .'/yaml/foo ' ));
563
+ $ loader ->load ('services.yml ' );
564
+
565
+ $ loader = new YamlFileLoader ($ container , new FileLocator (self ::$ fixturesPath .'/yaml/bar ' ));
566
+ $ loader ->load ('services.yml ' );
567
+
568
+ $ this ->assertCount (5 , $ container ->getDefinitions ());
569
+ }
570
+
558
571
public function testAnonymousServicesInInstanceof ()
559
572
{
560
573
$ container = new ContainerBuilder ();
@@ -582,7 +595,7 @@ public function testAnonymousServicesInInstanceof()
582
595
583
596
/**
584
597
* @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
585
- * @expectedExceptionMessage Creating an alias using the tag "!service" is not allowed in "anonymous_services_alias.yml".
598
+ * @expectedExceptionMessageRegExp / Creating an alias using the tag "!service" is not allowed in ".+ anonymous_services_alias\ .yml"\./
586
599
*/
587
600
public function testAnonymousServicesWithAliases ()
588
601
{
@@ -593,7 +606,7 @@ public function testAnonymousServicesWithAliases()
593
606
594
607
/**
595
608
* @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
596
- * @expectedExceptionMessage Using an anonymous service in a parameter is not allowed in "anonymous_services_in_parameters.yml".
609
+ * @expectedExceptionMessageRegExp / Using an anonymous service in a parameter is not allowed in ".+ anonymous_services_in_parameters\ .yml"\./
597
610
*/
598
611
public function testAnonymousServicesInParameters ()
599
612
{
@@ -614,7 +627,7 @@ public function testAutoConfigureInstanceof()
614
627
615
628
/**
616
629
* @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
617
- * @expectedExceptionMessage Service "_defaults" key must be an array, "NULL" given in "bad_empty_defaults.yml".
630
+ * @expectedExceptionMessageRegExp / Service "_defaults" key must be an array, "NULL" given in ".+ bad_empty_defaults\ .yml"\./
618
631
*/
619
632
public function testEmptyDefaultsThrowsClearException ()
620
633
{
@@ -625,7 +638,7 @@ public function testEmptyDefaultsThrowsClearException()
625
638
626
639
/**
627
640
* @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
628
- * @expectedExceptionMessage Service "_instanceof" key must be an array, "NULL" given in "bad_empty_instanceof.yml".
641
+ * @expectedExceptionMessageRegExp / Service "_instanceof" key must be an array, "NULL" given in ".+ bad_empty_instanceof\ .yml"\./
629
642
*/
630
643
public function testEmptyInstanceofThrowsClearException ()
631
644
{
0 commit comments