Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 93d8766

Browse filesBrowse files
committed
Add default mapping path for validator component
1 parent 8e5b3b1 commit 93d8766
Copy full SHA for 93d8766

File tree

Expand file treeCollapse file tree

3 files changed

+13
-4
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+13
-4
lines changed

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,6 +1020,11 @@ private function registerValidatorMapping(ContainerBuilder $container, array $co
10201020
}
10211021
}
10221022

1023+
$projectDir = $container->getParameter('kernel.project_dir');
1024+
if ($container->fileExists($dir = $projectDir.'/config/validator', '/^$/')) {
1025+
$this->registerMappingFilesFromDir($dir, $fileRecorder);
1026+
}
1027+
10231028
$this->registerMappingFilesFromConfig($container, $config, $fileRecorder);
10241029
}
10251030

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
+8-4Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -536,9 +536,13 @@ public function testTemplatingRequiresAtLeastOneEngine()
536536
public function testValidation()
537537
{
538538
$container = $this->createContainerFromFile('full');
539+
$projectDir = $container->getParameter('kernel.project_dir');
539540

540541
$ref = new \ReflectionClass('Symfony\Component\Form\Form');
541-
$xmlMappings = array(dirname($ref->getFileName()).'/Resources/config/validation.xml');
542+
$xmlMappings = array(
543+
dirname($ref->getFileName()).'/Resources/config/validation.xml',
544+
str_replace('/', DIRECTORY_SEPARATOR, $projectDir.'/config/validator/foo.xml'),
545+
);
542546

543547
$calls = $container->getDefinition('validator.builder')->getMethodCalls();
544548

@@ -626,7 +630,7 @@ public function testValidationPaths()
626630
$this->assertEquals(array(new Reference('validator.mapping.cache.symfony')), $calls[7][1]);
627631

628632
$xmlMappings = $calls[3][1][0];
629-
$this->assertCount(2, $xmlMappings);
633+
$this->assertCount(3, $xmlMappings);
630634
try {
631635
// Testing symfony/symfony
632636
$this->assertStringEndsWith('Component'.DIRECTORY_SEPARATOR.'Form/Resources/config/validation.xml', $xmlMappings[0]);
@@ -652,7 +656,7 @@ public function testValidationPathsUsingCustomBundlePath()
652656

653657
$calls = $container->getDefinition('validator.builder')->getMethodCalls();
654658
$xmlMappings = $calls[3][1][0];
655-
$this->assertCount(2, $xmlMappings);
659+
$this->assertCount(3, $xmlMappings);
656660

657661
try {
658662
// Testing symfony/symfony
@@ -694,7 +698,7 @@ public function testValidationMapping()
694698
$calls = $container->getDefinition('validator.builder')->getMethodCalls();
695699

696700
$this->assertSame('addXmlMappings', $calls[3][0]);
697-
$this->assertCount(2, $calls[3][1][0]);
701+
$this->assertCount(3, $calls[3][1][0]);
698702

699703
$this->assertSame('addYamlMappings', $calls[4][0]);
700704
$this->assertCount(3, $calls[4][1][0]);

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/config/validator/foo.xml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/config/validator/foo.xml
Whitespace-only changes.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.