[Serializer] Test that normalizers ignore non-existing attributes.
This commit is contained in:
parent
c498389f59
commit
df0fe30896
@ -426,6 +426,14 @@ class GetSetMethodNormalizerTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('foo', $obj->getFoo());
|
||||
$this->assertEquals('bar', $obj->getBar());
|
||||
}
|
||||
|
||||
public function testDenormalizeNonExistingAttribute()
|
||||
{
|
||||
$this->assertEquals(
|
||||
new PropertyDummy(),
|
||||
$this->normalizer->denormalize(array('non_existing' => true), __NAMESPACE__.'\PropertyDummy')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class GetSetDummy
|
||||
|
@ -333,6 +333,14 @@ class PropertyNormalizerTest extends \PHPUnit_Framework_TestCase
|
||||
$expected = array('me' => 'Symfony\Component\Serializer\Tests\Fixtures\PropertyCircularReferenceDummy');
|
||||
$this->assertEquals($expected, $this->normalizer->normalize($obj));
|
||||
}
|
||||
|
||||
public function testDenormalizeNonExistingAttribute()
|
||||
{
|
||||
$this->assertEquals(
|
||||
new PropertyDummy(),
|
||||
$this->normalizer->denormalize(array('non_existing' => true), __NAMESPACE__.'\PropertyDummy')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class PropertyDummy
|
||||
|
Reference in New Issue
Block a user