Skip to content

Commit c16690e

Browse files
author
Emmanuel BORGES
committed
test case
1 parent 52cfeb3 commit c16690e

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,26 @@ public function testLegacyUncallableCallbacks()
329329
$this->doTestUncallableCallbacks(true);
330330
}
331331

332+
public function testIgnoredAttributesInContext()
333+
{
334+
$ignoredAttributes = ['foo', 'bar', 'baz', 'object'];
335+
$this->createNormalizer([GetSetMethodNormalizer::IGNORED_ATTRIBUTES => $ignoredAttributes]);
336+
337+
$obj = new GetSetDummy();
338+
$obj->setFoo('foo');
339+
$obj->setBar('bar');
340+
$obj->setCamelCase(true);
341+
342+
$this->assertEquals(
343+
[
344+
'fooBar' => 'foobar',
345+
'camelCase' => true
346+
],
347+
$this->normalizer->normalize($obj, 'any')
348+
);
349+
}
350+
351+
332352
private function doTestUncallableCallbacks(bool $legacy = false)
333353
{
334354
$callbacks = ['bar' => null];

0 commit comments

Comments
 (0)