Skip to content

Commit 351d19d

Browse files
committed
Merge branch '2.7' into 2.8
* 2.7: Added 'default' color [HttpFoundation] Reload the session after regenerating its id [HttpFoundation] Add a test case to confirm a bug in session migration [Serializer] Fix ClassMetadata::sleep() [2.6] Static Code Analysis for Components and Bundles [Finder] Command::addAtIndex() fails with Command instance argument [DependencyInjection] Freeze also FrozenParameterBag::remove [Twig][Bridge] replaced `extends` with `use` in bootstrap_3_horizontal_layout.html.twig fix CS fixed CS Add a way to reset the singleton [Security] allow to use `method` in XML configs [Serializer] Fix Groups tests. Remove duplicate example Remove var not used due to returning early (introduced in 8982c32) [Serializer] Fix Groups PHPDoc Enhance hhvm test skip message fix for legacy asset() with EmptyVersionStrategy [Form] Added upgrade notes for #15061
2 parents a68e2db + 4ce2211 commit 351d19d

File tree

5 files changed

+34
-6
lines changed

5 files changed

+34
-6
lines changed

Annotation/Groups.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ class Groups
3030

3131
/**
3232
* @param array $data
33-
* @throws \InvalidArgumentException
33+
*
34+
* @throws InvalidArgumentException
3435
*/
3536
public function __construct(array $data)
3637
{
@@ -52,7 +53,7 @@ public function __construct(array $data)
5253
}
5354

5455
/**
55-
* Gets groups
56+
* Gets groups.
5657
*
5758
* @return array
5859
*/

Mapping/ClassMetadata.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function __sleep()
110110
{
111111
return array(
112112
'name',
113-
'attributes',
113+
'attributesMetadata',
114114
);
115115
}
116116
}

Tests/Annotation/GroupsTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,23 @@
1919
class GroupsTest extends \PHPUnit_Framework_TestCase
2020
{
2121
/**
22-
* @expectedException \InvalidArgumentException
22+
* @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
2323
*/
2424
public function testEmptyGroupsParameter()
2525
{
2626
new Groups(array('value' => array()));
2727
}
2828

2929
/**
30-
* @expectedException \InvalidArgumentException
30+
* @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
3131
*/
3232
public function testNotAnArrayGroupsParameter()
3333
{
3434
new Groups(array('value' => 'coopTilleuls'));
3535
}
3636

3737
/**
38-
* @expectedException \InvalidArgumentException
38+
* @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
3939
*/
4040
public function testInvalidGroupsParameter()
4141
{

Tests/Mapping/AttributeMetadataTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,14 @@ public function testMerge()
5454

5555
$this->assertEquals(array('a', 'b', 'c'), $attributeMetadata1->getGroups());
5656
}
57+
58+
public function testSerialize()
59+
{
60+
$attributeMetadata = new AttributeMetadata('attribute');
61+
$attributeMetadata->addGroup('a');
62+
$attributeMetadata->addGroup('b');
63+
64+
$serialized = serialize($attributeMetadata);
65+
$this->assertEquals($attributeMetadata, unserialize($serialized));
66+
}
5767
}

Tests/Mapping/ClassMetadataTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,21 @@ public function testMerge()
6262

6363
$this->assertEquals(array('a1' => $ac1), $classMetadata2->getAttributesMetadata());
6464
}
65+
66+
public function testSerialize()
67+
{
68+
$classMetadata = new ClassMetadata('a');
69+
70+
$a1 = $this->getMock('Symfony\Component\Serializer\Mapping\AttributeMetadataInterface');
71+
$a1->method('getName')->willReturn('b1');
72+
73+
$a2 = $this->getMock('Symfony\Component\Serializer\Mapping\AttributeMetadataInterface');
74+
$a2->method('getName')->willReturn('b2');
75+
76+
$classMetadata->addAttributeMetadata($a1);
77+
$classMetadata->addAttributeMetadata($a2);
78+
79+
$serialized = serialize($classMetadata);
80+
$this->assertEquals($classMetadata, unserialize($serialized));
81+
}
6582
}

0 commit comments

Comments
 (0)