8000 [Serializer] ObjectNormalizer: test normalize with a non-existing group · symfony/symfony@ab6c947 · GitHub
[go: up one dir, main page]

Skip to content

Commit ab6c947

Browse files
committed
[Serializer] ObjectNormalizer: test normalize with a non-existing group
1 parent 8603d5f commit ab6c947

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
class ObjectNormalizerTest extends \PHPUnit_Framework_TestCase
3030
{
3131
/**
32-
* @var ObjectNormalizerTest
32+
* @var ObjectNormalize
3333
*/
3434
private $normalizer;
3535
/**
@@ -239,6 +239,18 @@ public function testGroupsDenormalize()
239239
$this->assertEquals($obj, $normalized);
240240
}
241241

242+
public function testNormalizeNoPropertyInGroup()
243+
{
244+
$classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader()));
245+
$this->normalizer = new ObjectNormalizer($classMetadataFactory);
246+
$this->normalizer->setSerializer($this->serializer);
247+
248+
$obj = new GroupDummy();
249+
$obj->setFoo('foo');
250+
251+
$this->assertEquals(array(), $this->normalizer->normalize($obj, null, array('groups' => array('notExist'))));
252+
}
253+
242254
public function testGroupsNormalizeWithNameConverter()
243255
{
244256
$classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader()));

0 commit comments

Comments
 (0)
0