Skip to content

Commit

Permalink
GetSetMethodNormalizer correctly ignore the attributes specified in "…
Browse files Browse the repository at this point in the history
…ignored_attributes"
  • Loading branch information
Emmanuel BORGES committed Mar 7, 2019
1 parent 52cfeb3 commit 997adef
Showing 1 changed file with 19 additions and 0 deletions.
Expand Up @@ -329,6 +329,25 @@ public function testLegacyUncallableCallbacks()
$this->doTestUncallableCallbacks(true);
}

public function testIgnoredAttributesInContext()
{
$ignoredAttributes = ['foo', 'bar', 'baz', 'object'];
$this->createNormalizer([GetSetMethodNormalizer::IGNORED_ATTRIBUTES => $ignoredAttributes]);

$obj = new GetSetDummy();
$obj->setFoo('foo');
$obj->setBar('bar');
$obj->setCamelCase(true);

$this->assertEquals(
[
'fooBar' => 'foobar',
'camelCase' => true,
],
$this->normalizer->normalize($obj, 'any')
);
}

private function doTestUncallableCallbacks(bool $legacy = false)
{
$callbacks = ['bar' => null];
Expand Down

0 comments on commit 997adef

Please sign in to comment.