ArrayDummy example

protected function setUp(): void
    {
        $this->serializer = $this->createMock(DenormalizerInterface::class);
        $this->denormalizer = new ArrayDenormalizer();
        $this->denormalizer->setDenormalizer($this->serializer);
    }

    public function testDenormalize()
    {
        $series = [
            [[['foo' => 'one', 'bar' => 'two']]new ArrayDummy('one', 'two')],
            [[['foo' => 'three', 'bar' => 'four']]new ArrayDummy('three', 'four')],
        ];

        $this->serializer->expects($this->exactly(2))
            ->method('denormalize')
            ->willReturnCallback(function D$data) use (&$series) {
                [$expectedArgs$return] = array_shift($series);
                $this->assertSame($expectedArgs[$data]);

                return $return;
            })
        ;
Home | Imprint | This part of the site doesn't use cookies.