@@ -350,7 +350,8 @@ public function testValidationPaths()
350350 require_once __DIR__ .'/Fixtures/TestBundle/TestBundle.php ' ;
351351
352352 $ container = $ this ->createContainerFromFile ('validation_annotations ' , array (
353- 'kernel.bundles ' => array ('TestBundle ' => 'Symfony\Bundle\FrameworkBundle\Tests\TestBundle ' ),
353+ 'kernel.bundles ' => array ('TestBundle ' => 'Symfony \\Bundle \\FrameworkBundle \\Tests \\TestBundle ' ),
354+ 'kernel.bundles_metadata ' => array ('TestBundle ' => array ('namespace ' => 'Symfony \\Bundle \\FrameworkBundle \\Tests ' , 'parent ' => null , 'path ' => __DIR__ .'/Fixtures/TestBundle ' )),
354355 ));
355356
356357 $ calls = $ container ->getDefinition ('validator.builder ' )->getMethodCalls ();
@@ -378,6 +379,33 @@ public function testValidationPaths()
378379 $ this ->assertStringEndsWith ('TestBundle/Resources/config/validation.yml ' , $ yamlMappings [0 ]);
379380 }
380381
382+ public function testValidationPathsUsingCustomBundlePath ()
383+ {
384+ require_once __DIR__ .'/Fixtures/CustomPathBundle/src/CustomPathBundle.php ' ;
385+
386+ $ container = $ this ->createContainerFromFile ('validation_annotations ' , array (
387+ 'kernel.bundles ' => array ('CustomPathBundle ' => 'Symfony \\Bundle \\FrameworkBundle \\Tests \\CustomPathBundle ' ),
388+ 'kernel.bundles_metadata ' => array ('TestBundle ' => array ('namespace ' => 'Symfony \\Bundle \\FrameworkBundle \\Tests ' , 'parent ' => null , 'path ' => __DIR__ .'/Fixtures/CustomPathBundle ' )),
389+ ));
390+
391+ $ calls = $ container ->getDefinition ('validator.builder ' )->getMethodCalls ();
392+ $ xmlMappings = $ calls [3 ][1 ][0 ];
393+ $ this ->assertCount (2 , $ xmlMappings );
394+
395+ try {
396+ // Testing symfony/symfony
397+ $ this ->assertStringEndsWith ('Component ' .DIRECTORY_SEPARATOR .'Form/Resources/config/validation.xml ' , $ xmlMappings [0 ]);
398+ } catch (\Exception $ e ) {
399+ // Testing symfony/framework-bundle with deps=high
400+ $ this ->assertStringEndsWith ('symfony ' .DIRECTORY_SEPARATOR .'form/Resources/config/validation.xml ' , $ xmlMappings [0 ]);
401+ }
402+ $ this ->assertStringEndsWith ('CustomPathBundle/Resources/config/validation.xml ' , $ xmlMappings [1 ]);
403+
404+ $ yamlMappings = $ calls [4 ][1 ][0 ];
405+ $ this ->assertCount (1 , $ yamlMappings );
406+ $ this ->assertStringEndsWith ('CustomPathBundle/Resources/config/validation.yml ' , $ yamlMappings [0 ]);
407+ }
408+
381409 public function testValidationNoStaticMethod ()
382410 {
383411 $ container = $ this ->createContainerFromFile ('validation_no_static_method ' );
@@ -513,6 +541,7 @@ protected function createContainer(array $data = array())
513541 {
514542 return new ContainerBuilder (new ParameterBag (array_merge (array (
515543 'kernel.bundles ' => array ('FrameworkBundle ' => 'Symfony \\Bundle \\FrameworkBundle \\FrameworkBundle ' ),
544+ 'kernel.bundles_metadata ' => array ('FrameworkBundle ' => array ('namespace ' => 'Symfony \\Bundle \\FrameworkBundle ' , 'path ' => __DIR__ .'/../.. ' , 'parent ' => null )),
516545 'kernel.cache_dir ' => __DIR__ ,
517546 'kernel.debug ' => false ,
518547 'kernel.environment ' => 'test ' ,
0 commit comments