Skip to content

Commit

Permalink
Merge branch '2.7' into 2.8
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
fabpot committed Jul 9, 2015
2 parents a68e2db + 4ce2211 commit 351d19d
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 6 deletions.
5 changes: 3 additions & 2 deletions Annotation/Groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class Groups

/**
* @param array $data
* @throws \InvalidArgumentException
*
* @throws InvalidArgumentException
*/
public function __construct(array $data)
{
Expand All @@ -52,7 +53,7 @@ public function __construct(array $data)
}

/**
* Gets groups
* Gets groups.
*
* @return array
*/
Expand Down
2 changes: 1 addition & 1 deletion Mapping/ClassMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function __sleep()
{
return array(
'name',
'attributes',
'attributesMetadata',
);
}
}
6 changes: 3 additions & 3 deletions Tests/Annotation/GroupsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,23 @@
class GroupsTest extends \PHPUnit_Framework_TestCase
{
/**
* @expectedException \InvalidArgumentException
* @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
*/
public function testEmptyGroupsParameter()
{
new Groups(array('value' => array()));
}

/**
* @expectedException \InvalidArgumentException
* @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
*/
public function testNotAnArrayGroupsParameter()
{
new Groups(array('value' => 'coopTilleuls'));
}

/**
* @expectedException \InvalidArgumentException
* @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
*/
public function testInvalidGroupsParameter()
{
Expand Down
10 changes: 10 additions & 0 deletions Tests/Mapping/AttributeMetadataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,14 @@ public function testMerge()

$this->assertEquals(array('a', 'b', 'c'), $attributeMetadata1->getGroups());
}

public function testSerialize()
{
$attributeMetadata = new AttributeMetadata('attribute');
$attributeMetadata->addGroup('a');
$attributeMetadata->addGroup('b');

$serialized = serialize($attributeMetadata);
$this->assertEquals($attributeMetadata, unserialize($serialized));
}
}
17 changes: 17 additions & 0 deletions Tests/Mapping/ClassMetadataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,21 @@ public function testMerge()

$this->assertEquals(array('a1' => $ac1), $classMetadata2->getAttributesMetadata());
}

public function testSerialize()
{
$classMetadata = new ClassMetadata('a');

$a1 = $this->getMock('Symfony\Component\Serializer\Mapping\AttributeMetadataInterface');
$a1->method('getName')->willReturn('b1');

$a2 = $this->getMock('Symfony\Component\Serializer\Mapping\AttributeMetadataInterface');
$a2->method('getName')->willReturn('b2');

$classMetadata->addAttributeMetadata($a1);
$classMetadata->addAttributeMetadata($a2);

$serialized = serialize($classMetadata);
$this->assertEquals($classMetadata, unserialize($serialized));
}
}

0 comments on commit 351d19d

Please sign in to comment.