@@ -472,7 +472,8 @@ public function testValidationPaths()
472472 require_once __DIR__ .'/Fixtures/TestBundle/TestBundle.php ' ;
473473
474474 $ 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 ' )),
476477 ));
477478
478479 $ calls = $ container ->getDefinition ('validator.builder ' )->getMethodCalls ();
@@ -502,6 +503,33 @@ public function testValidationPaths()
502503 $ this ->assertStringEndsWith ('TestBundle/Resources/config/validation.yml ' , $ yamlMappings [0 ]);
503504 }
504505
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+
505533 public function testValidationNoStaticMethod ()
506534 {
507535 $ container = $ this ->createContainerFromFile ('validation_no_static_method ' );
@@ -763,6 +791,7 @@ protected function createContainer(array $data = array())
763791 {
764792 return new ContainerBuilder (new ParameterBag (array_merge (array (
765793 'kernel.bundles ' => array ('FrameworkBundle ' => 'Symfony \\Bundle \\FrameworkBundle \\FrameworkBundle ' ),
794+ 'kernel.bundles_metadata ' => array ('FrameworkBundle ' => array ('namespace ' => 'Symfony \\Bundle \\FrameworkBundle ' , 'path ' => __DIR__ .'/../.. ' , 'parent ' => null )),
766795 'kernel.cache_dir ' => __DIR__ ,
767796 'kernel.debug ' => false ,
768797 'kernel.environment ' => 'test ' ,
0 commit comments