@@ -375,7 +375,8 @@ public function testValidationPaths()
375375 require_once __DIR__ .'/Fixtures/TestBundle/TestBundle.php ' ;
376376
377377 $ container = $ this ->createContainerFromFile ('validation_annotations ' , array (
378- 'kernel.bundles ' => array ('TestBundle ' => 'Symfony\Bundle\FrameworkBundle\Tests\TestBundle ' ),
378+ 'kernel.bundles ' => array ('TestBundle ' => 'Symfony \\Bundle \\FrameworkBundle \\Tests \\TestBundle ' ),
379+ 'kernel.bundles_metadata ' => array ('TestBundle ' => array ('namespace ' => 'Symfony \\Bundle \\FrameworkBundle \\Tests ' , 'parent ' => null , 'path ' => __DIR__ .'/Fixtures/TestBundle ' )),
379380 ));
380381
381382 $ calls = $ container ->getDefinition ('validator.builder ' )->getMethodCalls ();
@@ -405,6 +406,33 @@ public function testValidationPaths()
405406 $ this ->assertStringEndsWith ('TestBundle/Resources/config/validation.yml ' , $ yamlMappings [0 ]);
406407 }
407408
409+ public function testValidationPathsUsingCustomBundlePath ()
410+ {
411+ require_once __DIR__ .'/Fixtures/CustomPathBundle/src/CustomPathBundle.php ' ;
412+
413+ $ container = $ this ->createContainerFromFile ('validation_annotations ' , array (
414+ 'kernel.bundles ' => array ('CustomPathBundle ' => 'Symfony \\Bundle \\FrameworkBundle \\Tests \\CustomPathBundle ' ),
415+ 'kernel.bundles_metadata ' => array ('TestBundle ' => array ('namespace ' => 'Symfony \\Bundle \\FrameworkBundle \\Tests ' , 'parent ' => null , 'path ' => __DIR__ .'/Fixtures/CustomPathBundle ' )),
416+ ));
417+
418+ $ calls = $ container ->getDefinition ('validator.builder ' )->getMethodCalls ();
419+ $ xmlMappings = $ calls [3 ][1 ][0 ];
420+ $ this ->assertCount (2 , $ xmlMappings );
421+
422+ try {
423+ // Testing symfony/symfony
424+ $ this ->assertStringEndsWith ('Component ' .DIRECTORY_SEPARATOR .'Form/Resources/config/validation.xml ' , $ xmlMappings [0 ]);
425+ } catch (\Exception $ e ) {
426+ // Testing symfony/framework-bundle with deps=high
427+ $ this ->assertStringEndsWith ('symfony ' .DIRECTORY_SEPARATOR .'form/Resources/config/validation.xml ' , $ xmlMappings [0 ]);
428+ }
429+ $ this ->assertStringEndsWith ('CustomPathBundle/Resources/config/validation.xml ' , $ xmlMappings [1 ]);
430+
431+ $ yamlMappings = $ calls [4 ][1 ][0 ];
432+ $ this ->assertCount (1 , $ yamlMappings );
433+ $ this ->assertStringEndsWith ('CustomPathBundle/Resources/config/validation.yml ' , $ yamlMappings [0 ]);
434+ }
435+
408436 public function testValidationNoStaticMethod ()
409437 {
410438 $ container = $ this ->createContainerFromFile ('validation_no_static_method ' );
@@ -630,6 +658,7 @@ protected function createContainer(array $data = array())
630658 {
631659 return new ContainerBuilder (new ParameterBag (array_merge (array (
632660 'kernel.bundles ' => array ('FrameworkBundle ' => 'Symfony \\Bundle \\FrameworkBundle \\FrameworkBundle ' ),
661+ 'kernel.bundles_metadata ' => array ('FrameworkBundle ' => array ('namespace ' => 'Symfony \\Bundle \\FrameworkBundle ' , 'path ' => __DIR__ .'/../.. ' , 'parent ' => null )),
633662 'kernel.cache_dir ' => __DIR__ ,
634663 'kernel.debug ' => false ,
635664 'kernel.environment ' => 'test ' ,
0 commit comments