minor #13818 [Serializer] Test that normalizers ignore non-existing attributes. (dunglas)
This PR was squashed before being merged into the 2.7 branch (closes #13818).
Discussion
----------
[Serializer] Test that normalizers ignore non-existing attributes.
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? |no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
Test the behavior of normalizers when an attribute doesn't exist.
Commits
-------
df0fe30
[Serializer] Test that normalizers ignore non-existing attributes.
This commit is contained in:
commit
12cf04f8f3
@ -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