Skip to content

Commit

Permalink
bug #25480 [FrameworkBundle] add missing validation options to XSD fi…
Browse files Browse the repository at this point in the history
…le (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
-------

e7d8e17 add missing validation options to XSD file
  • Loading branch information
fabpot committed Dec 14, 2017
2 parents ccc9367 + e7d8e17 commit 9ff3776
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 0 deletions.
Expand Up @@ -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>

Expand Down
@@ -0,0 +1,7 @@
<?php

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

$container->loadFromExtension('framework', array(
'validation' => array(
'translation_domain' => 'messages',
),
));
@@ -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>
@@ -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>
@@ -0,0 +1,3 @@
framework:
validation:
strict_email: true
@@ -0,0 +1,3 @@
framework:
validation:
translation_domain: messages
Expand Up @@ -420,6 +420,20 @@ public function testValidationNoStaticMethod()
// 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');
Expand Down

0 comments on commit 9ff3776

Please sign in to comment.