@@ -375,7 +375,8 @@ public function testValidationPaths()
375
375
require_once __DIR__ .'/Fixtures/TestBundle/TestBundle.php ' ;
376
376
377
377
$ 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 ' )),
379
380
));
380
381
381
382
$ calls = $ container ->getDefinition ('validator.builder ' )->getMethodCalls ();
@@ -405,6 +406,33 @@ public function testValidationPaths()
405
406
$ this ->assertStringEndsWith ('TestBundle/Resources/config/validation.yml ' , $ yamlMappings [0 ]);
406
407
}
407
408
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
+
408
436
public function testValidationNoStaticMethod ()
409
437
{
410
438
$ container = $ this ->createContainerFromFile ('validation_no_static_method ' );
@@ -630,6 +658,7 @@ protected function createContainer(array $data = array())
630
658
{
631
659
return new ContainerBuilder (new ParameterBag (array_merge (array (
632
660
'kernel.bundles ' => array ('FrameworkBundle ' => 'Symfony \\Bundle \\FrameworkBundle \\FrameworkBundle ' ),
661
+ 'kernel.bundles_metadata ' => array ('FrameworkBundle ' => array ('namespace ' => 'Symfony \\Bundle \\FrameworkBundle ' , 'path ' => __DIR__ .'/../.. ' , 'parent ' => null )),
633
662
'kernel.cache_dir ' => __DIR__ ,
634
663
'kernel.debug ' => false ,
635
664
'kernel.environment ' => 'test ' ,
0 commit comments