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 9438206

Browse filesBrowse files
committed
Complete the removal of API versions in the validator component
Thanks to the PHP version requirement bump to 5.3.9+, the BC layer can be available all the time.
1 parent 75088c0 commit 9438206
Copy full SHA for 9438206

File tree

Expand file treeCollapse file tree

66 files changed

+128
-1567
lines changed
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree

66 files changed

+128
-1567
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,8 +763,9 @@ private function registerValidationConfiguration(array $config, ContainerBuilder
763763

764764
// You can use this parameter to check the API version in your own
765765
// bundle extension classes
766+
// This is set to 2.5-bc for compatibility with Symfony 2.5 and 2.6.
766767
// @deprecated since version 2.7, to be removed in 3.0
767-
$container->setParameter('validator.api', $config['api']);
768+
$container->setParameter('validator.api', '2.5-bc');
768769
}
769770

770771
private function getValidatorMappingFiles(ContainerBuilder $container)

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ protected static function getBundleDefaultConfig()
153153
'static_method' => array('loadValidatorMetadata'),
154154
'translation_domain' => 'validators',
155155
'strict_email' => false,
156-
'api' => '2.5-bc',
157156
),
158157
'annotations' => array(
159158
'cache' => 'file',

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_2_5_api.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_2_5_api.php
-9Lines changed: 0 additions & 9 deletions
This file was deleted.

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_2_5_bc_api.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_2_5_bc_api.php
-9Lines changed: 0 additions & 9 deletions
This file was deleted.

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_auto_api.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_auto_api.php
-9Lines changed: 0 additions & 9 deletions
This file was deleted.

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_implicit_api.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_implicit_api.php
-8Lines changed: 0 additions & 8 deletions
This file was deleted.

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_2_5_api.xml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_2_5_api.xml
-12Lines changed: 0 additions & 12 deletions
This file was deleted.

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_2_5_bc_api.xml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_2_5_bc_api.xml
-12Lines changed: 0 additions & 12 deletions
This file was deleted.

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_auto_api.xml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_auto_api.xml
-12Lines changed: 0 additions & 12 deletions
This file was deleted.

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_implicit_api.xml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_implicit_api.xml
-12Lines changed: 0 additions & 12 deletions
This file was deleted.

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_2_5_api.yml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_2_5_api.yml
-5Lines changed: 0 additions & 5 deletions
This file was deleted.

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_2_5_bc_api.yml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_2_5_bc_api.yml
-5Lines changed: 0 additions & 5 deletions
This file was deleted.

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_auto_api.yml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_auto_api.yml
-5Lines changed: 0 additions & 5 deletions
This file was deleted.

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_implicit_api.yml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_implicit_api.yml
-4Lines changed: 0 additions & 4 deletions
This file was deleted.

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
+4-74Lines changed: 4 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ public function testValidation()
276276

277277
$calls = $container->getDefinition('validator.builder')->getMethodCalls();
278278

279-
$this->assertCount(7, $calls);
279+
$this->assertCount(6, $calls);
280280
$this->assertSame('setConstraintValidatorFactory', $calls[0][0]);
281281
$this->assertEquals(array(new Reference('validator.validator_factory')), $calls[0][1]);
282282
$this->assertSame('setTranslator', $calls[1][0]);
@@ -289,8 +289,6 @@ public function testValidation()
289289
$this->assertSame(array('loadValidatorMetadata'), $calls[4][1]);
290290
$this->assertSame('setMetadataCache', $calls[5][0]);
291291
$this->assertEquals(array(new Reference('validator.mapping.cache.apc')), $calls[5][1]);
292-
$this->assertSame('setApiVersion', $calls[6][0]);
293-
$this->assertEquals(array(Validation::API_VERSION_2_5_BC), $calls[6][1]);
294292
}
295293

296294
/**
@@ -337,7 +335,7 @@ public function testValidationAnnotations()
337335

338336
$calls = $container->getDefinition('validator.builder')->getMethodCalls();
339337

340-
$this->assertCount(7, $calls);
338+
$this->assertCount(6, $calls);
341339
$this->assertSame('enableAnnotationMapping', $calls[4][0]);
342340
$this->assertEquals(array(new Reference('annotation_reader')), $calls[4][1]);
343341
$this->assertSame('addMethodMapping', $calls[5][0]);
@@ -355,7 +353,7 @@ public function testValidationPaths()
355353

356354
$calls = $container->getDefinition('validator.builder')->getMethodCalls();
357355

358-
$this->assertCount(8, $calls);
356+
$this->assertCount(7, $calls);
359357
$this->assertSame('addXmlMappings', $calls[3][0]);
360358
$this->assertSame('addYamlMappings', $calls[4][0]);
361359
$this->assertSame('enableAnnotationMapping', $calls[5][0]);
@@ -378,79 +376,11 @@ public function testValidationNoStaticMethod()
378376

379377
$calls = $container->getDefinition('validator.builder')->getMethodCalls();
380378

381-
$this->assertCount(5, $calls);
379+
$this->assertCount(4, $calls);
382380
$this->assertSame('addXmlMappings', $calls[3][0]);
383381
// no cache, no annotations, no static methods
384382
}
385383

386-
public function testValidation2Dot5Api()
387-
{
388-
$container = $this->createContainerFromFile('validation_2_5_api');
389-
390-
$calls = $container->getDefinition('validator.builder')->getMethodCalls();
391-
392-
$this->assertCount(6, $calls);
393-
$this->assertSame('addXmlMappings', $calls[3][0]);
394-
$this->assertSame('addMethodMapping', $calls[4][0]);
395-
$this->assertSame(array('loadValidatorMetadata'), $calls[4][1]);
396-
$this->assertSame('setApiVersion', $calls[5][0]);
397-
$this->assertSame(array(Validation::API_VERSION_2_5), $calls[5][1]);
398-
$this->assertSame('Symfony\Component\Validator\Validator\ValidatorInterface', $container->getParameter('validator.class'));
399-
// no cache, no annotations
400-
}
401-
402-
public function testValidation2Dot5BcApi()
403-
{
404-
$container = $this->createContainerFromFile('validation_2_5_bc_api');
405-
406-
$calls = $container->getDefinition('validator.builder')->getMethodCalls();
407-
408-
$this->assertCount(6, $calls);
409-
$this->assertSame('addXmlMappings', $calls[3][0]);
410-
$this->assertSame('addMethodMapping', $calls[4][0]);
411-
$this->assertSame(array('loadValidatorMetadata'), $calls[4][1]);
412-
$this->assertSame('setApiVersion', $calls[5][0]);
413-
$this->assertSame(array(Validation::API_VERSION_2_5_BC), $calls[5][1]);
414-
$this->assertSame('Symfony\Component\Validator\ValidatorInterface', $container->getParameter('validator.class'));
415-
// no cache, no annotations
416-
}
417-
418-
public function testValidationImplicitApi()
419-
{
420-
$container = $this->createContainerFromFile('validation_implicit_api');
421-
422-
$calls = $container->getDefinition('validator.builder')->getMethodCalls();
423-
424-
$this->assertCount(6, $calls);
425-
$this->assertSame('addXmlMappings', $calls[3][0]);
426-
$this->assertSame('addMethodMapping', $calls[4][0]);
427-
$this->assertSame(array('loadValidatorMetadata'), $calls[4][1]);
428-
$this->assertSame('setApiVersion', $calls[5][0]);
429-
// no cache, no annotations
430-
431-
$this->assertSame(array(Validation::API_VERSION_2_5_BC), $calls[5][1]);
432-
}
433-
434-
/**
435-
* This feature is equivalent to the implicit api, only that the "api"
436-
* key is explicitly set to "auto".
437-
*/
438-
public function testValidationAutoApi()
439-
{
440-
$container = $this->createContainerFromFile('validation_auto_api');
441-
442-
$calls = $container->getDefinition('validator.builder')->getMethodCalls();
443-
444-
$this->assertCount(6, $calls);
445-
$this->assertSame('addXmlMappings', $calls[3][0]);
446-
$this->assertSame('addMethodMapping', $calls[4][0]);
447-
$this->assertSame(array('loadValidatorMetadata'), $calls[4][1]);
448-
$this->assertSame('setApiVersion', $calls[5][0]);
449-
// no cache, no annotations
450-
451-
$this->assertSame(array(Validation::API_VERSION_2_5_BC), $calls[5][1]);
452-
}
453-
454384
public function testFormsCanBeEnabledWithoutCsrfProtection()
455385
{
456386
$container = $this->createContainerFromFile('form_no_csrf');

0 commit comments

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