Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 08d6fda

Browse files
author
Hugo Hamon
committed
[FrameworkBundle] adds legacy tests for deprecated configuration keys.
1 parent 6e4f0b5 commit 08d6fda

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@
33
$container->loadFromExtension('framework', array(
44
'secret' => 's3cr3t',
55
'default_locale' => 'fr',
6-
'form' => null,
6+
'form' => array(
7+
'csrf_protection' => array(
8+
'field_name' => '_csrf',
9+
),
10+
),
711
'http_method_override' => false,
812
'trusted_proxies' => array('127.0.0.1', '10.0.0.1'),
913
'csrf_protection' => array(
1014
'enabled' => true,
11-
'field_name' => '_csrf',
1215
),
1316
'esi' => array(
1417
'enabled' => true,

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
88

99
<framework:config secret="s3cr3t" ide="file%%link%%format" default-locale="fr" trusted-proxies="127.0.0.1, 10.0.0.1" http-method-override="false">
10-
<framework:csrf-protection enabled="true" field-name="_csrf" />
11-
<framework:form />
10+
<framework:csrf-protection enabled="true" />
11+
<framework:form>
12+
<framework:csrf-protection field-name="_csrf"/>
13+
</framework:form>
1214
<framework:esi enabled="true" />
1315
<framework:profiler only-exceptions="true" enabled="false" />
1416
<framework:router resource="%kernel.root_dir%/config/routing.xml" type="xml" />

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
framework:
22
secret: s3cr3t
33
default_locale: fr
4-
form: ~
4+
form:
5+
csrf_protection:
6+
field_name: _csrf
57
http_method_override: false
68
trusted_proxies: ['127.0.0.1', '10.0.0.1']
79
csrf_protection:
810
enabled: true
9-
field_name: _csrf
1011
esi:
1112
enabled: true
1213
profiler:

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,8 +486,10 @@ public function testFormsCanBeEnabledWithoutCsrfProtection()
486486
$this->assertFalse($container->getParameter('form.type_extension.csrf.enabled'));
487487
}
488488

489-
public function testFormCsrfFieldNameCanBeSetUnderCsrfSettings()
489+
public function testLegacyFormCsrfFieldNameCanBeSetUnderCsrfSettings()
490490
{
491+
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
492+
491493
$container = $this->createContainerFromFile('form_csrf_sets_field_name');
492494

493495
$this->assertTrue($container->getParameter('form.type_extension.csrf.enabled'));

0 commit comments

Comments
 (0)