Replace gender by eye color in tests

This commit is contained in:
Raphaëll Roussel 2019-01-26 20:55:54 +01:00
parent afb7bb5dde
commit 72180342b7
9 changed files with 27 additions and 27 deletions

View File

@ -4,5 +4,5 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Serialization;
class Author
{
public $gender;
public $eyeColor;
}

View File

@ -4,5 +4,5 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Serialization;
class Person
{
public $gender;
public $eyeColor;
}

View File

@ -1,4 +1,4 @@
Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Serialization\Author:
attributes:
gender:
eyeColor:
groups: ['group1', 'group2']

View File

@ -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>

View File

@ -4,5 +4,5 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Validation;
class Author
{
public $gender;
public $eyeColor;
}

View File

@ -4,5 +4,5 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Validation;
class Person
{
public $gender;
public $eyeColor;
}

View File

@ -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. }

View File

@ -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>

View File

@ -190,11 +190,11 @@ XML;
{
$array = [
'#' => 'Paul',
'@gender' => 'm',
'@eye-color' => 'brown',
];
$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'));
}
@ -203,11 +203,11 @@ XML;
{
$array = [
'firstname' => 'Paul',
'@gender' => 'm',
'@eye-color' => 'brown',
];
$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'));
}
@ -227,11 +227,11 @@ XML;
public function testEncodeScalarWithAttribute()
{
$array = [
'person' => ['@gender' => 'M', '#' => 'Peter'],
'person' => ['@eye-color' => 'brown', '#' => 'Peter'],
];
$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'));
}
@ -330,11 +330,11 @@ XML;
$this->encoder->setSerializer($serializer);
$array = [
'person' => ['@gender' => 'M', '#' => 'Peter'],
'person' => ['@eye-color' => 'brown', '#' => 'Peter'],
];
$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));
}
@ -398,10 +398,10 @@ XML;
public function testDecodeScalarWithAttribute()
{
$source = '<?xml version="1.0"?>'."\n".
'<response><person gender="M">Peter</person></response>'."\n";
'<response><person eye-color="brown">Peter</person></response>'."\n";
$expected = [
'person' => ['@gender' => 'M', '#' => 'Peter'],
'person' => ['@eye-color' => 'brown', '#' => 'Peter'],
];
$this->assertEquals($expected, $this->encoder->decode($source, 'xml'));
@ -410,11 +410,11 @@ XML;
public function testDecodeScalarRootAttributes()
{
$source = '<?xml version="1.0"?>'."\n".
'<person gender="M">Peter</person>'."\n";
'<person eye-color="brown">Peter</person>'."\n";
$expected = [
'#' => 'Peter',
'@gender' => 'M',
'@eye-color' => 'brown',
];
$this->assertEquals($expected, $this->encoder->decode($source, 'xml'));
@ -423,12 +423,12 @@ XML;
public function testDecodeRootAttributes()
{
$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 = [
'firstname' => 'Peter',
'lastname' => 'Mac Calloway',
'@gender' => 'M',
'@eye-color' => 'brown',
];
$this->assertEquals($expected, $this->encoder->decode($source, 'xml'));