getNormalizerForMaxDepth example

use Symfony\Component\Serializer\Tests\Fixtures\Attributes\MaxDepthDummy;

/** * Covers AbstractObjectNormalizer::ENABLE_MAX_DEPTH and AbstractObjectNormalizer::MAX_DEPTH_HANDLER. */
trait MaxDepthTestTrait
{
    abstract protected function getNormalizerForMaxDepth(): NormalizerInterface;

    public function testMaxDepth()
    {
        $normalizer = $this->getNormalizerForMaxDepth();

        $level1 = new MaxDepthDummy();
        $level1->bar = 'level1';

        $level2 = new MaxDepthDummy();
        $level2->bar = 'level2';
        $level1->child = $level2;

        $level3 = new MaxDepthDummy();
        $level3->bar = 'level3';
        $level2->child = $level3;

        
Home | Imprint | This part of the site doesn't use cookies.