@@ -472,7 +472,8 @@ public function testValidationPaths()
472
472
require_once __DIR__ .'/Fixtures/TestBundle/TestBundle.php ' ;
473
473
474
474
$ container = $ this ->createContainerFromFile ('validation_annotations ' , array (
475
- 'kernel.bundles ' => array ('TestBundle ' => 'Symfony\Bundle\FrameworkBundle\Tests\TestBundle ' ),
475
+ 'kernel.bundles ' => array ('TestBundle ' => 'Symfony \\Bundle \\FrameworkBundle \\Tests \\TestBundle ' ),
476
+ 'kernel.bundles_metadata ' => array ('TestBundle ' => array ('namespace ' => 'Symfony \\Bundle \\FrameworkBundle \\Tests ' , 'parent ' => null , 'path ' => __DIR__ .'/Fixtures/TestBundle ' )),
476
477
));
477
478
478
479
$ calls = $ container ->getDefinition ('validator.builder ' )->getMethodCalls ();
@@ -502,6 +503,33 @@ public function testValidationPaths()
502
503
$ this ->assertStringEndsWith ('TestBundle/Resources/config/validation.yml ' , $ yamlMappings [0 ]);
503
504
}
504
505
506
+ public function testValidationPathsUsingCustomBundlePath ()
507
+ {
508
+ require_once __DIR__ .'/Fixtures/CustomPathBundle/src/CustomPathBundle.php ' ;
509
+
510
+ $ container = $ this ->createContainerFromFile ('validation_annotations ' , array (
511
+ 'kernel.bundles ' => array ('CustomPathBundle ' => 'Symfony \\Bundle \\FrameworkBundle \\Tests \\CustomPathBundle ' ),
512
+ 'kernel.bundles_metadata ' => array ('TestBundle ' => array ('namespace ' => 'Symfony \\Bundle \\FrameworkBundle \\Tests ' , 'parent ' => null , 'path ' => __DIR__ .'/Fixtures/CustomPathBundle ' )),
513
+ ));
514
+
515
+ $ calls = $ container ->getDefinition ('validator.builder ' )->getMethodCalls ();
516
+ $ xmlMappings = $ calls [3 ][1 ][0 ];
517
+ $ this ->assertCount (2 , $ xmlMappings );
518
+
519
+ try {
520
+ // Testing symfony/symfony
521
+ $ this ->assertStringEndsWith ('Component ' .DIRECTORY_SEPARATOR .'Form/Resources/config/validation.xml ' , $ xmlMappings [0 ]);
522
+ } catch (\Exception $ e ) {
523
+ // Testing symfony/framework-bundle with deps=high
524
+ $ this ->assertStringEndsWith ('symfony ' .DIRECTORY_SEPARATOR .'form/Resources/config/validation.xml ' , $ xmlMappings [0 ]);
525
+ }
526
+ $ this ->assertStringEndsWith ('CustomPathBundle/Resources/config/validation.xml ' , $ xmlMappings [1 ]);
527
+
528
+ $ yamlMappings = $ calls [4 ][1 ][0 ];
529
+ $ this ->assertCount (1 , $ yamlMappings );
530
+ $ this ->assertStringEndsWith ('CustomPathBundle/Resources/config/validation.yml ' , $ yamlMappings [0 ]);
531
+ }
532
+
505
533
public function testValidationNoStaticMethod ()
506
534
{
507
535
$ container = $ this ->createContainerFromFile ('validation_no_static_method ' );
@@ -763,6 +791,7 @@ protected function createContainer(array $data = array())
763
791
{
764
792
return new ContainerBuilder (new ParameterBag (array_merge (array (
765
793
'kernel.bundles ' => array ('FrameworkBundle ' => 'Symfony \\Bundle \\FrameworkBundle \\FrameworkBundle ' ),
794
+ 'kernel.bundles_metadata ' => array ('FrameworkBundle ' => array ('namespace ' => 'Symfony \\Bundle \\FrameworkBundle ' , 'path ' => __DIR__ .'/../.. ' , 'parent ' => null )),
766
795
'kernel.cache_dir ' => __DIR__ ,
767
796
'kernel.debug ' => false ,
768
797
'kernel.environment ' => 'test ' ,
0 commit comments