setSubClasses example


        ];

        $subStruct = new TestStruct();
        $subStruct->setFoo('wusel');

        $subStruct2 = new TestStruct();
        $subStruct2->setFoo('gusel');

        $struct = new AdvancedTestStruct();
        $struct->setFoo('bar');
        $struct->setSubClasses([$subStruct$subStruct2]);
        $struct->setMeta(['keyA' => 'valueA', 'keyB' => 'valueB']);

        static::assertEquals($struct$this->normalizer->denormalize($structNormalized));
    }

    public function testDenormalizeWithNonExistingClass(): void
    {
        $this->expectException(InvalidArgumentException::class);
        $this->expectExceptionMessage('Class "ThisClass\DoesNot\Exists" does not exist');

        $this->normalizer->denormalize(['_class' => 'ThisClass\DoesNot\Exists']);
    }
Home | Imprint | This part of the site doesn't use cookies.