@@ -350,7 +350,8 @@ public function testValidationPaths()
350
350
require_once __DIR__ .'/Fixtures/TestBundle/TestBundle.php ' ;
351
351
352
352
$ 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 ' )),
354
355
));
355
356
356
357
$ calls = $ container ->getDefinition ('validator.builder ' )->getMethodCalls ();
@@ -378,6 +379,33 @@ public function testValidationPaths()
378
379
$ this ->assertStringEndsWith ('TestBundle/Resources/config/validation.yml ' , $ yamlMappings [0 ]);
379
380
}
380
381
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
+
381
409
public function testValidationNoStaticMethod ()
382
410
{
383
411
$ container = $ this ->createContainerFromFile ('validation_no_static_method ' );
@@ -513,6 +541,7 @@ protected function createContainer(array $data = array())
513
541
{
514
542
return new ContainerBuilder (new ParameterBag (array_merge (array (
515
543
'kernel.bundles ' => array ('FrameworkBundle ' => 'Symfony \\Bundle \\FrameworkBundle \\FrameworkBundle ' ),
544
+ 'kernel.bundles_metadata ' => array ('FrameworkBundle ' => array ('namespace ' => 'Symfony \\Bundle \\FrameworkBundle ' , 'path ' => __DIR__ .'/../.. ' , 'parent ' => null )),
516
545
'kernel.cache_dir ' => __DIR__ ,
517
546
'kernel.debug ' => false ,
518
547
'kernel.environment ' => 'test ' ,
0 commit comments