diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php index 37948bef47192..9f5b74eb2c3e6 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php @@ -329,6 +329,26 @@ 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];