minor #29994 Replace gender by eye color in tests (Raphaëll Roussel)
This PR was merged into the 3.4 branch.
Discussion
----------
Replace gender by eye color in tests
| Q | A
| ------------- | ---
| Branch? | 3.4 <!-- see below -->
| Bug fix? | yes
| New feature? | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass? | yes <!-- please add some, will be required by reviewers -->
| Fixed tickets | #29737 <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | <!-- required for new features -->
<!--
Write a short README entry for your feature/bugfix here (replace this comment block.)
This will help people understand your PR and can be used as a start of the Doc PR.
Additionally:
- Bug fixes must be submitted against the lowest branch where they apply
(lowest branches are regularly merged to upper ones so they get the fixes too).
- Features and deprecations must be submitted against the master branch.
-->
I've slightly changed @derrabus proposition to use color only because of the potentially racist interpretation when used for a person, open for discussion though.
Commits
-------
72180342b7
Replace gender by eye color in tests
This commit is contained in:
commit
dc8c506f00
@ -4,5 +4,5 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Serialization;
|
|||||||
|
|
||||||
class Author
|
class Author
|
||||||
{
|
{
|
||||||
public $gender;
|
public $eyeColor;
|
||||||
}
|
}
|
||||||
|
@ -4,5 +4,5 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Serialization;
|
|||||||
|
|
||||||
class Person
|
class Person
|
||||||
{
|
{
|
||||||
public $gender;
|
public $eyeColor;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Serialization\Author:
|
Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Serialization\Author:
|
||||||
attributes:
|
attributes:
|
||||||
gender:
|
eyeColor:
|
||||||
groups: ['group1', 'group2']
|
groups: ['group1', 'group2']
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
http://symfony.com/schema/dic/serializer-mapping/serializer-mapping-1.0.xsd"
|
http://symfony.com/schema/dic/serializer-mapping/serializer-mapping-1.0.xsd"
|
||||||
>
|
>
|
||||||
<class name="Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Serialization\Person">
|
<class name="Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Serialization\Person">
|
||||||
<attribute name="gender">
|
<attribute name="eyeColor">
|
||||||
<group>group1</group>
|
<group>group1</group>
|
||||||
<group>group2</group>
|
<group>group2</group>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
@ -4,5 +4,5 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Validation;
|
|||||||
|
|
||||||
class Author
|
class Author
|
||||||
{
|
{
|
||||||
public $gender;
|
public $eyeColor;
|
||||||
}
|
}
|
||||||
|
@ -4,5 +4,5 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Validation;
|
|||||||
|
|
||||||
class Person
|
class Person
|
||||||
{
|
{
|
||||||
public $gender;
|
public $eyeColor;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Validation\Author:
|
Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Validation\Author:
|
||||||
properties:
|
properties:
|
||||||
gender:
|
eyeColor:
|
||||||
- Choice: { choices: [male, female, other], message: Choose a valid gender. }
|
- Choice: { choices: [brown, green, blue], message: Choose a valid eye color. }
|
||||||
|
@ -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">
|
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">
|
<class name="Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Validation\Person">
|
||||||
<property name="gender">
|
<property name="eyeColor">
|
||||||
<constraint name="Choice">
|
<constraint name="Choice">
|
||||||
<option name="choices">
|
<option name="choices">
|
||||||
<value>male</value>
|
<value>brown</value>
|
||||||
<value>female</value>
|
<value>green</value>
|
||||||
<value>other</value>
|
<value>blue</value>
|
||||||
</option>
|
</option>
|
||||||
<option name="message">Choose a valid gender.</option>
|
<option name="message">Choose a valid eye color.</option>
|
||||||
</constraint>
|
</constraint>
|
||||||
</property>
|
</property>
|
||||||
</class>
|
</class>
|
||||||
|
@ -190,11 +190,11 @@ XML;
|
|||||||
{
|
{
|
||||||
$array = [
|
$array = [
|
||||||
'#' => 'Paul',
|
'#' => 'Paul',
|
||||||
'@gender' => 'm',
|
'@eye-color' => 'brown',
|
||||||
];
|
];
|
||||||
|
|
||||||
$expected = '<?xml version="1.0"?>'."\n".
|
$expected = '<?xml version="1.0"?>'."\n".
|
||||||
'<response gender="m">Paul</response>'."\n";
|
'<response eye-color="brown">Paul</response>'."\n";
|
||||||
|
|
||||||
$this->assertEquals($expected, $this->encoder->encode($array, 'xml'));
|
$this->assertEquals($expected, $this->encoder->encode($array, 'xml'));
|
||||||
}
|
}
|
||||||
@ -203,11 +203,11 @@ XML;
|
|||||||
{
|
{
|
||||||
$array = [
|
$array = [
|
||||||
'firstname' => 'Paul',
|
'firstname' => 'Paul',
|
||||||
'@gender' => 'm',
|
'@eye-color' => 'brown',
|
||||||
];
|
];
|
||||||
|
|
||||||
$expected = '<?xml version="1.0"?>'."\n".
|
$expected = '<?xml version="1.0"?>'."\n".
|
||||||
'<response gender="m"><firstname>Paul</firstname></response>'."\n";
|
'<response eye-color="brown"><firstname>Paul</firstname></response>'."\n";
|
||||||
|
|
||||||
$this->assertEquals($expected, $this->encoder->encode($array, 'xml'));
|
$this->assertEquals($expected, $this->encoder->encode($array, 'xml'));
|
||||||
}
|
}
|
||||||
@ -227,11 +227,11 @@ XML;
|
|||||||
public function testEncodeScalarWithAttribute()
|
public function testEncodeScalarWithAttribute()
|
||||||
{
|
{
|
||||||
$array = [
|
$array = [
|
||||||
'person' => ['@gender' => 'M', '#' => 'Peter'],
|
'person' => ['@eye-color' => 'brown', '#' => 'Peter'],
|
||||||
];
|
];
|
||||||
|
|
||||||
$expected = '<?xml version="1.0"?>'."\n".
|
$expected = '<?xml version="1.0"?>'."\n".
|
||||||
'<response><person gender="M">Peter</person></response>'."\n";
|
'<response><person eye-color="brown">Peter</person></response>'."\n";
|
||||||
|
|
||||||
$this->assertEquals($expected, $this->encoder->encode($array, 'xml'));
|
$this->assertEquals($expected, $this->encoder->encode($array, 'xml'));
|
||||||
}
|
}
|
||||||
@ -330,11 +330,11 @@ XML;
|
|||||||
$this->encoder->setSerializer($serializer);
|
$this->encoder->setSerializer($serializer);
|
||||||
|
|
||||||
$array = [
|
$array = [
|
||||||
'person' => ['@gender' => 'M', '#' => 'Peter'],
|
'person' => ['@eye-color' => 'brown', '#' => 'Peter'],
|
||||||
];
|
];
|
||||||
|
|
||||||
$expected = '<?xml version="1.0"?>'."\n".
|
$expected = '<?xml version="1.0"?>'."\n".
|
||||||
'<test><person gender="M">Peter</person></test>'."\n";
|
'<test><person eye-color="brown">Peter</person></test>'."\n";
|
||||||
|
|
||||||
$this->assertEquals($expected, $serializer->serialize($array, 'xml', $options));
|
$this->assertEquals($expected, $serializer->serialize($array, 'xml', $options));
|
||||||
}
|
}
|
||||||
@ -398,10 +398,10 @@ XML;
|
|||||||
public function testDecodeScalarWithAttribute()
|
public function testDecodeScalarWithAttribute()
|
||||||
{
|
{
|
||||||
$source = '<?xml version="1.0"?>'."\n".
|
$source = '<?xml version="1.0"?>'."\n".
|
||||||
'<response><person gender="M">Peter</person></response>'."\n";
|
'<response><person eye-color="brown">Peter</person></response>'."\n";
|
||||||
|
|
||||||
$expected = [
|
$expected = [
|
||||||
'person' => ['@gender' => 'M', '#' => 'Peter'],
|
'person' => ['@eye-color' => 'brown', '#' => 'Peter'],
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->assertEquals($expected, $this->encoder->decode($source, 'xml'));
|
$this->assertEquals($expected, $this->encoder->decode($source, 'xml'));
|
||||||
@ -410,11 +410,11 @@ XML;
|
|||||||
public function testDecodeScalarRootAttributes()
|
public function testDecodeScalarRootAttributes()
|
||||||
{
|
{
|
||||||
$source = '<?xml version="1.0"?>'."\n".
|
$source = '<?xml version="1.0"?>'."\n".
|
||||||
'<person gender="M">Peter</person>'."\n";
|
'<person eye-color="brown">Peter</person>'."\n";
|
||||||
|
|
||||||
$expected = [
|
$expected = [
|
||||||
'#' => 'Peter',
|
'#' => 'Peter',
|
||||||
'@gender' => 'M',
|
'@eye-color' => 'brown',
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->assertEquals($expected, $this->encoder->decode($source, 'xml'));
|
$this->assertEquals($expected, $this->encoder->decode($source, 'xml'));
|
||||||
@ -423,12 +423,12 @@ XML;
|
|||||||
public function testDecodeRootAttributes()
|
public function testDecodeRootAttributes()
|
||||||
{
|
{
|
||||||
$source = '<?xml version="1.0"?>'."\n".
|
$source = '<?xml version="1.0"?>'."\n".
|
||||||
'<person gender="M"><firstname>Peter</firstname><lastname>Mac Calloway</lastname></person>'."\n";
|
'<person eye-color="brown"><firstname>Peter</firstname><lastname>Mac Calloway</lastname></person>'."\n";
|
||||||
|
|
||||||
$expected = [
|
$expected = [
|
||||||
'firstname' => 'Peter',
|
'firstname' => 'Peter',
|
||||||
'lastname' => 'Mac Calloway',
|
'lastname' => 'Mac Calloway',
|
||||||
'@gender' => 'M',
|
'@eye-color' => 'brown',
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->assertEquals($expected, $this->encoder->decode($source, 'xml'));
|
$this->assertEquals($expected, $this->encoder->decode($source, 'xml'));
|
||||||
|
Reference in New Issue
Block a user