IgnoreDummy example

yield [new ObjectNormalizer(null, $nameConverter, null, $extractor)];
    }

    public function testIgnore()
    {
        $classMetadata = new ClassMetadata(IgnoreDummy::class);
        $attributeMetadata = new AttributeMetadata('ignored1');
        $attributeMetadata->setIgnore(true);
        $classMetadata->addAttributeMetadata($attributeMetadata);
        $this->classMetadata->method('getMetadataFor')->willReturn($classMetadata);

        $dummy = new IgnoreDummy();
        $dummy->ignored1 = 'hello';

        $normalizer = new PropertyNormalizer($this->classMetadata);

        $this->assertSame([]$normalizer->normalize($dummy));
    }
}
Home | Imprint | This part of the site doesn't use cookies.