Skip to content

Commit

Permalink
[Serializer] Test that normalizers ignore non-existing attributes.
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas authored and fabpot committed Mar 3, 2015
1 parent c498389 commit df0fe30
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Expand Up @@ -426,6 +426,14 @@ public function testObjectToPopulate()
$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
Expand Down
Expand Up @@ -333,6 +333,14 @@ public function testCircularReferenceHandler()
$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
Expand Down

0 comments on commit df0fe30

Please sign in to comment.