bug #25480 [FrameworkBundle] add missing validation options to XSD file (xabbuh)

This PR was merged into the 2.7 branch.

Discussion
----------

[FrameworkBundle] add missing validation options to XSD file

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Commits
-------

e7d8e1783b add missing validation options to XSD file
This commit is contained in:
Fabien Potencier 2017-12-14 10:38:41 -08:00
commit 9ff3776b78
8 changed files with 58 additions and 0 deletions

View File

@ -204,6 +204,8 @@
<xsd:attribute name="cache" type="xsd:string" />
<xsd:attribute name="enable-annotations" type="xsd:boolean" />
<xsd:attribute name="static-method" type="xsd:boolean" />
<xsd:attribute name="translation-domain" type="xsd:string" />
<xsd:attribute name="strict-email" type="xsd:boolean" />
<xsd:attribute name="api" type="validator_api_version" />
</xsd:complexType>

View File

@ -0,0 +1,7 @@
<?php
$container->loadFromExtension('framework', array(
'validation' => array(
'strict_email' => true,
),
));

View File

@ -0,0 +1,7 @@
<?php
$container->loadFromExtension('framework', array(
'validation' => array(
'translation_domain' => 'messages',
),
));

View File

@ -0,0 +1,11 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
<framework:config>
<framework:validation strict-email="true" />
</framework:config>
</container>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
<framework:config>
<framework:validation translation-domain="messages" />
</framework:config>
</container>

View File

@ -0,0 +1,3 @@
framework:
validation:
strict_email: true

View File

@ -0,0 +1,3 @@
framework:
validation:
translation_domain: messages

View File

@ -420,6 +420,20 @@ abstract class FrameworkExtensionTest extends TestCase
// no cache, no annotations, no static methods
}
public function testValidationTranslationDomain()
{
$container = $this->createContainerFromFile('validation_translation_domain');
$this->assertSame('messages', $container->getParameter('validator.translation_domain'));
}
public function testValidationStrictEmail()
{
$container = $this->createContainerFromFile('validation_strict_email');
$this->assertTrue($container->getDefinition('validator.email')->getArgument(0));
}
public function testFormsCanBeEnabledWithoutCsrfProtection()
{
$container = $this->createContainerFromFile('form_no_csrf');