name: AbstractNormalizerTest class_comment: "# * Provides a dummy Normalizer which extends the AbstractNormalizer.\n\ # *\n# * @author Konstantin S. M. M\xF6llers " dependencies: - name: MockObject type: class source: PHPUnit\Framework\MockObject\MockObject - name: TestCase type: class source: PHPUnit\Framework\TestCase - name: PhpDocExtractor type: class source: Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor - name: JsonEncoder type: class source: Symfony\Component\Serializer\Encoder\JsonEncoder - name: MissingConstructorArgumentsException type: class source: Symfony\Component\Serializer\Exception\MissingConstructorArgumentsException - name: NotNormalizableValueException type: class source: Symfony\Component\Serializer\Exception\NotNormalizableValueException - name: AttributeMetadata type: class source: Symfony\Component\Serializer\Mapping\AttributeMetadata - name: ClassMetadata type: class source: Symfony\Component\Serializer\Mapping\ClassMetadata - name: ClassMetadataFactory type: class source: Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory - name: ClassMetadataFactoryInterface type: class source: Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface - name: LoaderChain type: class source: Symfony\Component\Serializer\Mapping\Loader\LoaderChain - name: NameConverterInterface type: class source: Symfony\Component\Serializer\NameConverter\NameConverterInterface - name: AbstractNormalizer type: class source: Symfony\Component\Serializer\Normalizer\AbstractNormalizer - name: ObjectNormalizer type: class source: Symfony\Component\Serializer\Normalizer\ObjectNormalizer - name: PropertyNormalizer type: class source: Symfony\Component\Serializer\Normalizer\PropertyNormalizer - name: Serializer type: class source: Symfony\Component\Serializer\Serializer - name: AbstractNormalizerDummy type: class source: Symfony\Component\Serializer\Tests\Fixtures\AbstractNormalizerDummy - name: IgnoreDummy type: class source: Symfony\Component\Serializer\Tests\Fixtures\Attributes\IgnoreDummy - name: Dummy type: class source: Symfony\Component\Serializer\Tests\Fixtures\Dummy - name: DummyWithWithVariadicParameterConstructor type: class source: Symfony\Component\Serializer\Tests\Fixtures\DummyWithWithVariadicParameterConstructor - name: NullableConstructorArgumentDummy type: class source: Symfony\Component\Serializer\Tests\Fixtures\NullableConstructorArgumentDummy - name: NullableOptionalConstructorArgumentDummy type: class source: Symfony\Component\Serializer\Tests\Fixtures\NullableOptionalConstructorArgumentDummy - name: StaticConstructorDummy type: class source: Symfony\Component\Serializer\Tests\Fixtures\StaticConstructorDummy - name: StaticConstructorNormalizer type: class source: Symfony\Component\Serializer\Tests\Fixtures\StaticConstructorNormalizer - name: UnitEnumDummy type: class source: Symfony\Component\Serializer\Tests\Fixtures\UnitEnumDummy - name: VariadicConstructorTypedArgsDummy type: class source: Symfony\Component\Serializer\Tests\Fixtures\VariadicConstructorTypedArgsDummy properties: [] methods: - name: testObjectWithVariadicConstructorTypedArguments visibility: public parameters: - name: normalizer comment: "# * Provides a dummy Normalizer which extends the AbstractNormalizer.\n\ # *\n# * @author Konstantin S. M. M\xF6llers \n# */\n\ # class AbstractNormalizerTest extends TestCase\n# {\n# private AbstractNormalizerDummy\ \ $normalizer;\n# private MockObject&ClassMetadataFactoryInterface $classMetadata;\n\ # \n# protected function setUp(): void\n# {\n# $loader = $this->getMockBuilder(LoaderChain::class)->setConstructorArgs([[]])->getMock();\n\ # $this->classMetadata = $this->getMockBuilder(ClassMetadataFactory::class)->setConstructorArgs([$loader])->getMock();\n\ # $this->normalizer = new AbstractNormalizerDummy($this->classMetadata);\n# }\n\ # \n# public function testGetAllowedAttributesAsString()\n# {\n# $classMetadata\ \ = new ClassMetadata('c');\n# \n# $a1 = new AttributeMetadata('a1');\n# $classMetadata->addAttributeMetadata($a1);\n\ # \n# $a2 = new AttributeMetadata('a2');\n# $a2->addGroup('test');\n# $classMetadata->addAttributeMetadata($a2);\n\ # \n# $a3 = new AttributeMetadata('a3');\n# $a3->addGroup('other');\n# $classMetadata->addAttributeMetadata($a3);\n\ # \n# $a4 = new AttributeMetadata('a4');\n# $a4->addGroup('test');\n# $a4->addGroup('other');\n\ # $classMetadata->addAttributeMetadata($a4);\n# \n# $this->classMetadata->method('getMetadataFor')->willReturn($classMetadata);\n\ # \n# $result = $this->normalizer->getAllowedAttributes('c', [AbstractNormalizer::GROUPS\ \ => ['test']], true);\n# $this->assertEquals(['a2', 'a4'], $result);\n# \n# $result\ \ = $this->normalizer->getAllowedAttributes('c', [AbstractNormalizer::GROUPS =>\ \ ['other']], true);\n# $this->assertEquals(['a3', 'a4'], $result);\n# \n# $result\ \ = $this->normalizer->getAllowedAttributes('c', [AbstractNormalizer::GROUPS =>\ \ ['*']], true);\n# $this->assertEquals(['a1', 'a2', 'a3', 'a4'], $result);\n\ # }\n# \n# public function testGetAllowedAttributesAsObjects()\n# {\n# $classMetadata\ \ = new ClassMetadata('c');\n# \n# $a1 = new AttributeMetadata('a1');\n# $classMetadata->addAttributeMetadata($a1);\n\ # \n# $a2 = new AttributeMetadata('a2');\n# $a2->addGroup('test');\n# $classMetadata->addAttributeMetadata($a2);\n\ # \n# $a3 = new AttributeMetadata('a3');\n# $a3->addGroup('other');\n# $classMetadata->addAttributeMetadata($a3);\n\ # \n# $a4 = new AttributeMetadata('a4');\n# $a4->addGroup('test');\n# $a4->addGroup('other');\n\ # $classMetadata->addAttributeMetadata($a4);\n# \n# $this->classMetadata->method('getMetadataFor')->willReturn($classMetadata);\n\ # \n# $result = $this->normalizer->getAllowedAttributes('c', [AbstractNormalizer::GROUPS\ \ => ['test']], false);\n# $this->assertEquals([$a2, $a4], $result);\n# \n# $result\ \ = $this->normalizer->getAllowedAttributes('c', [AbstractNormalizer::GROUPS =>\ \ 'test'], false);\n# $this->assertEquals([$a2, $a4], $result);\n# \n# $result\ \ = $this->normalizer->getAllowedAttributes('c', [AbstractNormalizer::GROUPS =>\ \ ['other']], false);\n# $this->assertEquals([$a3, $a4], $result);\n# \n# $result\ \ = $this->normalizer->getAllowedAttributes('c', [AbstractNormalizer::GROUPS =>\ \ ['*']], false);\n# $this->assertEquals([$a1, $a2, $a3, $a4], $result);\n# }\n\ # \n# public function testObjectWithStaticConstructor()\n# {\n# $normalizer =\ \ new StaticConstructorNormalizer();\n# $dummy = $normalizer->denormalize(['foo'\ \ => 'baz'], StaticConstructorDummy::class);\n# \n# $this->assertInstanceOf(StaticConstructorDummy::class,\ \ $dummy);\n# $this->assertEquals('baz', $dummy->quz);\n# $this->assertNull($dummy->foo);\n\ # }\n# \n# public function testObjectWithNullableConstructorArgument()\n# {\n\ # $normalizer = new ObjectNormalizer();\n# $dummy = $normalizer->denormalize(['foo'\ \ => null], NullableOptionalConstructorArgumentDummy::class);\n# \n# $this->assertNull($dummy->getFoo());\n\ # }\n# \n# public function testObjectWithNullableConstructorArgumentWithoutInput()\n\ # {\n# $normalizer = new ObjectNormalizer();\n# $dummy = $normalizer->denormalize([],\ \ NullableOptionalConstructorArgumentDummy::class);\n# \n# $this->assertNull($dummy->getFoo());\n\ # }\n# \n# public function testObjectWithNullableNonOptionalConstructorArgument()\n\ # {\n# $normalizer = new ObjectNormalizer();\n# $dummy = $normalizer->denormalize(['foo'\ \ => null], NullableConstructorArgumentDummy::class);\n# \n# $this->assertNull($dummy->getFoo());\n\ # }\n# \n# public function testObjectWithNullableNonOptionalConstructorArgumentWithoutInput()\n\ # {\n# $normalizer = new ObjectNormalizer();\n# $dummy = $normalizer->denormalize([],\ \ NullableConstructorArgumentDummy::class);\n# \n# $this->assertNull($dummy->getFoo());\n\ # }\n# \n# public function testObjectWithNullableNonOptionalConstructorArgumentWithoutInputAndRequireAllProperties()\n\ # {\n# $normalizer = new ObjectNormalizer();\n# \n# $this->expectException(MissingConstructorArgumentsException::class);\n\ # \n# $normalizer->denormalize([], NullableConstructorArgumentDummy::class, null,\ \ [AbstractNormalizer::REQUIRE_ALL_PROPERTIES => true]);\n# }\n# \n# /**\n# *\ \ @dataProvider getNormalizer\n# * @dataProvider getNormalizerWithCustomNameConverter" - name: testVariadicSerializationWithPreservingKeys visibility: public parameters: - name: normalizer comment: '# * @dataProvider getNormalizer' - name: getNormalizer visibility: public parameters: [] comment: null - name: testVariadicConstructorDenormalization visibility: public parameters: [] comment: null - name: getNormalizerWithCustomNameConverter visibility: public parameters: [] comment: null - name: normalize visibility: public parameters: - name: propertyName - name: class default: 'null' - name: format default: 'null' - name: context default: '[]' comment: null - name: denormalize visibility: public parameters: - name: propertyName - name: class default: 'null' - name: format default: 'null' - name: context default: '[]' comment: null - name: testIgnore visibility: public parameters: [] comment: null - name: testDenormalizeWhenObjectNotInstantiable visibility: public parameters: [] comment: null traits: - PHPUnit\Framework\MockObject\MockObject - PHPUnit\Framework\TestCase - Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor - Symfony\Component\Serializer\Encoder\JsonEncoder - Symfony\Component\Serializer\Exception\MissingConstructorArgumentsException - Symfony\Component\Serializer\Exception\NotNormalizableValueException - Symfony\Component\Serializer\Mapping\AttributeMetadata - Symfony\Component\Serializer\Mapping\ClassMetadata - Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory - Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface - Symfony\Component\Serializer\Mapping\Loader\LoaderChain - Symfony\Component\Serializer\NameConverter\NameConverterInterface - Symfony\Component\Serializer\Normalizer\AbstractNormalizer - Symfony\Component\Serializer\Normalizer\ObjectNormalizer - Symfony\Component\Serializer\Normalizer\PropertyNormalizer - Symfony\Component\Serializer\Serializer - Symfony\Component\Serializer\Tests\Fixtures\AbstractNormalizerDummy - Symfony\Component\Serializer\Tests\Fixtures\Attributes\IgnoreDummy - Symfony\Component\Serializer\Tests\Fixtures\Dummy - Symfony\Component\Serializer\Tests\Fixtures\DummyWithWithVariadicParameterConstructor - Symfony\Component\Serializer\Tests\Fixtures\NullableConstructorArgumentDummy - Symfony\Component\Serializer\Tests\Fixtures\NullableOptionalConstructorArgumentDummy - Symfony\Component\Serializer\Tests\Fixtures\StaticConstructorDummy - Symfony\Component\Serializer\Tests\Fixtures\StaticConstructorNormalizer - Symfony\Component\Serializer\Tests\Fixtures\UnitEnumDummy - Symfony\Component\Serializer\Tests\Fixtures\VariadicConstructorTypedArgsDummy interfaces: - NameConverterInterface