@@ -342,7 +342,8 @@ public function testValidationPaths()
342342 require_once __DIR__ .'/Fixtures/TestBundle/TestBundle.php ' ;
343343
344344 $ container = $ this ->createContainerFromFile ('validation_annotations ' , array (
345- 'kernel.bundles ' => array ('TestBundle ' => 'Symfony\Bundle\FrameworkBundle\Tests\TestBundle ' ),
345+ 'kernel.bundles ' => array ('TestBundle ' => 'Symfony \\Bundle \\FrameworkBundle \\Tests \\TestBundle ' ),
346+ 'kernel.bundles_metadata ' => array ('TestBundle ' => array ('namespace ' => 'Symfony \\Bundle \\FrameworkBundle \\Tests ' , 'parent ' => null , 'path ' => __DIR__ .'/Fixtures/TestBundle ' )),
346347 ));
347348
348349 $ calls = $ container ->getDefinition ('validator.builder ' )->getMethodCalls ();
@@ -370,6 +371,33 @@ public function testValidationPaths()
370371 $ this ->assertStringEndsWith ('TestBundle/Resources/config/validation.yml ' , $ yamlMappings [0 ]);
371372 }
372373
374+ public function testValidationPathsUsingCustomBundlePath ()
375+ {
376+ require_once __DIR__ .'/Fixtures/CustomPathBundle/src/CustomPathBundle.php ' ;
377+
378+ $ container = $ this ->createContainerFromFile ('validation_annotations ' , array (
379+ 'kernel.bundles ' => array ('CustomPathBundle ' => 'Symfony \\Bundle \\FrameworkBundle \\Tests \\CustomPathBundle ' ),
380+ 'kernel.bundles_metadata ' => array ('TestBundle ' => array ('namespace ' => 'Symfony \\Bundle \\FrameworkBundle \\Tests ' , 'parent ' => null , 'path ' => __DIR__ .'/Fixtures/CustomPathBundle ' )),
381+ ));
382+
383+ $ calls = $ container ->getDefinition ('validator.builder ' )->getMethodCalls ();
384+ $ xmlMappings = $ calls [3 ][1 ][0 ];
385+ $ this ->assertCount (2 , $ xmlMappings );
386+
387+ try {
388+ // Testing symfony/symfony
389+ $ this ->assertStringEndsWith ('Component ' .DIRECTORY_SEPARATOR .'Form/Resources/config/validation.xml ' , $ xmlMappings [0 ]);
390+ } catch (\Exception $ e ) {
391+ // Testing symfony/framework-bundle with deps=high
392+ $ this ->assertStringEndsWith ('symfony ' .DIRECTORY_SEPARATOR .'form/Resources/config/validation.xml ' , $ xmlMappings [0 ]);
393+ }
394+ $ this ->assertStringEndsWith ('CustomPathBundle/Resources/config/validation.xml ' , $ xmlMappings [1 ]);
395+
396+ $ yamlMappings = $ calls [4 ][1 ][0 ];
397+ $ this ->assertCount (1 , $ yamlMappings );
398+ $ this ->assertStringEndsWith ('CustomPathBundle/Resources/config/validation.yml ' , $ yamlMappings [0 ]);
399+ }
400+
373401 public function testValidationNoStaticMethod ()
374402 {
375403 $ container = $ this ->createContainerFromFile ('validation_no_static_method ' );
@@ -472,6 +500,7 @@ protected function createContainer(array $data = array())
472500 {
473501 return new ContainerBuilder (new ParameterBag (array_merge (array (
474502 'kernel.bundles ' => array ('FrameworkBundle ' => 'Symfony \\Bundle \\FrameworkBundle \\FrameworkBundle ' ),
503+ 'kernel.bundles_metadata ' => array ('FrameworkBundle ' => array ('namespace ' => 'Symfony \\Bundle \\FrameworkBundle ' , 'path ' => __DIR__ .'/../.. ' , 'parent ' => null )),
475504 'kernel.cache_dir ' => __DIR__ ,
476505 'kernel.debug ' => false ,
477506 'kernel.environment ' => 'test ' ,
0 commit comments