Skip to content

Commit 5707ad2

Browse files
Merge branch '4.1' into 4.2
* 4.1: [Routing] dont redirect routes with greedy trailing vars with no explicit slash skip native serialize among child and parent serializable objects [Routing] backport tests from 4.1 [MonologBridge] Remove unused local variable Remove unreachable code Add PackageNameTest to ConfigurationTest also add in the changelog the corresponding entry to this PR Support use of hyphen in asset package name Remove gendered pronouns Replace gender by eye color in tests [Security] dont do nested calls to serialize()
2 parents e6efcb5 + 7bcfcb8 commit 5707ad2

File tree

10 files changed

+43
-13
lines changed

10 files changed

+43
-13
lines changed

DependencyInjection/Configuration.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,7 @@ private function addAssetsSection(ArrayNodeDefinition $rootNode)
648648
->fixXmlConfig('package')
649649
->children()
650650
->arrayNode('packages')
651+
->normalizeKeys(false)
651652
->useAttributeAsKey('name')
652653
->prototype('array')
653654
->fixXmlConfig('base_url')

Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,35 @@ public function testAssetsCanBeEnabled()
102102
$this->assertEquals($defaultConfig, $config['assets']);
103103
}
104104

105+
/**
106+
* @dataProvider provideValidAssetsPackageNameConfigurationTests
107+
*/
108+
public function testValidAssetsPackageNameConfiguration($packageName)
109+
{
110+
$processor = new Processor();
111+
$configuration = new Configuration(true);
112+
$config = $processor->processConfiguration($configuration, [
113+
[
114+
'assets' => [
115+
'packages' => [
116+
$packageName => [],
117+
],
118+
],
119+
],
120+
]);
121+
122+
$this->assertArrayHasKey($packageName, $config['assets']['packages']);
123+
}
124+
125+
public function provideValidAssetsPackageNameConfigurationTests()
126+
{
127+
return [
128+
['foobar'],
129+
['foo-bar'],
130+
['foo_bar'],
131+
];
132+
}
133+
105134
/**
106135
* @dataProvider provideInvalidAssetConfigurationTests
107136
*/

Tests/Fixtures/Serialization/Author.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

55
class Author
66
{
7-
public $gender;
7+
public $eyeColor;
88
}

Tests/Fixtures/Serialization/Person.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

55
class Person
66
{
7-
public $gender;
7+
public $eyeColor;
88
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Serialization\Author:
22
attributes:
3-
gender:
3+
eyeColor:
44
groups: ['group1', 'group2']

Tests/Fixtures/Serialization/Resources/person.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
http://symfony.com/schema/dic/serializer-mapping/serializer-mapping-1.0.xsd"
66
>
77
<class name="Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Serialization\Person">
8-
<attribute name="gender">
8+
<attribute name="eyeColor">
99
<group>group1</group>
1010
<group>group2</group>
1111
</attribute>

Tests/Fixtures/Validation/Author.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

55
class Author
66
{
7-
public $gender;
7+
public $eyeColor;
88
}

Tests/Fixtures/Validation/Person.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

55
class Person
66
{
7-
public $gender;
7+
public $eyeColor;
88
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Validation\Author:
22
properties:
3-
gender:
4-
- Choice: { choices: [male, female, other], message: Choose a valid gender. }
3+
eyeColor:
4+
- Choice: { choices: [brown, green, blue], message: Choose a valid eye color. }

Tests/Fixtures/Validation/Resources/person.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">
55

66
<class name="Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Validation\Person">
7-
<property name="gender">
7+
<property name="eyeColor">
88
<constraint name="Choice">
99
<option name="choices">
10-
<value>male</value>
11-
<value>female</value>
12-
<value>other</value>
10+
<value>brown</value>
11+
<value>green</value>
12+
<value>blue</value>
1313
</option>
14-
<option name="message">Choose a valid gender.</option>
14+
<option name="message">Choose a valid eye color.</option>
1515
</constraint>
1616
</property>
1717
</class>

0 commit comments

Comments
 (0)