8000 [Serializer] Test that normalizers ignore non-existing attributes. · rubenrua/symfony@df0fe30 · GitHub
[go: up one dir, main page]

Skip to content

Commit df0fe30

Browse files
dunglasfabpot
authored andcommitted
[Serializer] Test that normalizers ignore non-existing attributes.
1 parent c498389 commit df0fe30

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,14 @@ public function testObjectToPopulate()
426426
$this->assertEquals('foo', $obj->getFoo());
427427
$this->assertEquals('bar', $obj->getBar());
428428
}
429+
430+
public function testDenormalizeNonExistingAttribute()
431+
{
432+
$this->assertEquals(
433+
new PropertyDummy(),
434+
$this->normalizer->denormalize(array('non_existing' => true), __NAMESPACE__.'\PropertyDummy')
435+
);
436+
}
429437
}
430438

431439
class GetSetDummy

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,14 @@ public function testCircularReferenceHandler()
333333
$expected = array('me' => 'Symfony\Component\Serializer\Tests\Fixtures\PropertyCircularReferenceDummy');
334334
$this->assertEquals($expected, $this->normalizer->normalize($obj));
335335
}
336+
337+
public function testDenormalizeNonExistingAttribute()
338+
{
339+
$this->assertEquals(
340+
new PropertyDummy(),
341+
$this->normalizer->denormalize(array('non_existing' => true), __NAMESPACE__.'\PropertyDummy')
342+
);
343+
}
336344
}
337345

338346
class PropertyDummy

0 commit comments

Comments
 (0)
0