@@ -342,7 +342,8 @@ public function testValidationPaths()
342
342
require_once __DIR__ .'/Fixtures/TestBundle/TestBundle.php ' ;
343
343
344
344
$ 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 ' )),
346
347
));
347
348
348
349
$ calls = $ container ->getDefinition ('validator.builder ' )->getMethodCalls ();
@@ -370,6 +371,33 @@ public function testValidationPaths()
370
371
$ this ->assertStringEndsWith ('TestBundle/Resources/config/validation.yml ' , $ yamlMappings [0 ]);
371
372
}
372
373
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
+
373
401
public function testValidationNoStaticMethod ()
374
402
{
375
403
$ container = $ this ->createContainerFromFile ('validation_no_static_method ' );
@@ -472,6 +500,7 @@ protected function createContainer(array $data = array())
472
500
{
473
501
return new ContainerBuilder (new ParameterBag (array_merge (array (
474
502
'kernel.bundles ' => array ('FrameworkBundle ' => 'Symfony \\Bundle \\FrameworkBundle \\FrameworkBundle ' ),
503
+ 'kernel.bundles_metadata ' => array ('FrameworkBundle ' => array ('namespace ' => 'Symfony \\Bundle \\FrameworkBundle ' , 'path ' => __DIR__ .'/../.. ' , 'parent ' => null )),
475
504
'kernel.cache_dir ' => __DIR__ ,
476
505
'kernel.debug ' => false ,
477
506
'kernel.environment ' => 'test ' ,
0 commit comments