TestStruct example

class StructNormalizerTest extends TestCase
{
    private StructNormalizer $normalizer;

    protected function setUp(): void
    {
        $this->normalizer = new StructNormalizer();
    }

    public function testSupportFormat(): void
    {
        static::assertTrue($this->normalizer->supportsNormalization(new TestStruct()));
        static::assertFalse($this->normalizer->supportsNormalization('string'));
        static::assertFalse($this->normalizer->supportsNormalization(1));
        static::assertFalse($this->normalizer->supportsNormalization(null));
        static::assertFalse($this->normalizer->supportsNormalization(false));
        static::assertFalse($this->normalizer->supportsNormalization(['array']));
        static::assertFalse($this->normalizer->supportsNormalization(new \stdClass()));
    }

    public function testNormalizationOfSimpleStruct(): void
    {
        $struct = new TestStruct();
        
Home | Imprint | This part of the site doesn't use cookies.