Skip to content

Commit 7bcfcb8

Browse files
Merge branch '3.4' into 4.1
* 3.4: skip native serialize among child and parent serializable objects [Routing] backport tests from 4.1 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 1afa727 + 20e35d7 commit 7bcfcb8

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
@@ -644,6 +644,7 @@ private function addAssetsSection(ArrayNodeDefinition $rootNode)
644644
->fixXmlConfig('package')
645645
->children()
646646
->arrayNode('packages')
647+
->normalizeKeys(false)
647648
->useAttributeAsKey('name')
648649
->prototype('array')
649650
->fixXmlConfig('base_url')

Tests/DependencyInjection/ConfigurationTest.php

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

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

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)