Skip to content

Commit

Permalink
Merge branch '3.4' into 4.1
Browse files Browse the repository at this point in the history
* 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()
  • Loading branch information
nicolas-grekas committed Jan 29, 2019
2 parents 1afa727 + 20e35d7 commit 7bcfcb8
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 13 deletions.
1 change: 1 addition & 0 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,7 @@ private function addAssetsSection(ArrayNodeDefinition $rootNode)
->fixXmlConfig('package')
->children()
->arrayNode('packages')
->normalizeKeys(false)
->useAttributeAsKey('name')
->prototype('array')
->fixXmlConfig('base_url')
Expand Down
29 changes: 29 additions & 0 deletions Tests/DependencyInjection/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,35 @@ public function testAssetsCanBeEnabled()
$this->assertEquals($defaultConfig, $config['assets']);
}

/**
* @dataProvider provideValidAssetsPackageNameConfigurationTests
*/
public function testValidAssetsPackageNameConfiguration($packageName)
{
$processor = new Processor();
$configuration = new Configuration(true);
$config = $processor->processConfiguration($configuration, [
[
'assets' => [
'packages' => [
$packageName => [],
],
],
],
]);

$this->assertArrayHasKey($packageName, $config['assets']['packages']);
}

public function provideValidAssetsPackageNameConfigurationTests()
{
return [
['foobar'],
['foo-bar'],
['foo_bar'],
];
}

/**
* @dataProvider provideInvalidAssetConfigurationTests
*/
Expand Down
2 changes: 1 addition & 1 deletion Tests/Fixtures/Serialization/Author.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

class Author
{
public $gender;
public $eyeColor;
}
2 changes: 1 addition & 1 deletion Tests/Fixtures/Serialization/Person.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

class Person
{
public $gender;
public $eyeColor;
}
2 changes: 1 addition & 1 deletion Tests/Fixtures/Serialization/Resources/author.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Serialization\Author:
attributes:
gender:
eyeColor:
groups: ['group1', 'group2']
2 changes: 1 addition & 1 deletion Tests/Fixtures/Serialization/Resources/person.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
http://symfony.com/schema/dic/serializer-mapping/serializer-mapping-1.0.xsd"
>
<class name="Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Serialization\Person">
<attribute name="gender">
<attribute name="eyeColor">
<group>group1</group>
<group>group2</group>
</attribute>
Expand Down
2 changes: 1 addition & 1 deletion Tests/Fixtures/Validation/Author.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

class Author
{
public $gender;
public $eyeColor;
}
2 changes: 1 addition & 1 deletion Tests/Fixtures/Validation/Person.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

class Person
{
public $gender;
public $eyeColor;
}
4 changes: 2 additions & 2 deletions Tests/Fixtures/Validation/Resources/author.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Validation\Author:
properties:
gender:
- Choice: { choices: [male, female, other], message: Choose a valid gender. }
eyeColor:
- Choice: { choices: [brown, green, blue], message: Choose a valid eye color. }
10 changes: 5 additions & 5 deletions Tests/Fixtures/Validation/Resources/person.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">

<class name="Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Validation\Person">
<property name="gender">
<property name="eyeColor">
<constraint name="Choice">
<option name="choices">
<value>male</value>
<value>female</value>
<value>other</value>
<value>brown</value>
<value>green</value>
<value>blue</value>
</option>
<option name="message">Choose a valid gender.</option>
<option name="message">Choose a valid eye color.</option>
</constraint>
</property>
</class>
Expand Down

0 comments on commit 7bcfcb8

Please sign in to comment.