Neos\Flow\Tests\Unit\ObjectManagement\ObjectSerializerTest::buildStorageArrayCreatesTheCorrectArrayForAnArrayPropertyWithContainingObject PHP Method

buildStorageArrayCreatesTheCorrectArrayForAnArrayPropertyWithContainingObject() public method

    public function buildStorageArrayCreatesTheCorrectArrayForAnArrayPropertyWithContainingObject()
    {
        $className = 'DummyClass' . md5(uniqid(mt_rand(), true));
        eval('class ' . $className . ' {}');
        $mockObject = $this->createMock($className);
        $objectName = spl_object_hash($mockObject);
        $objectSerializer = $this->getAccessibleMock(ObjectSerializer::class, ['serializeObjectAsPropertyArray'], [], '', false);
        $objectSerializer->expects($this->once())->method('serializeObjectAsPropertyArray')->with($mockObject);
        $arrayProperty = ['key1' => 1, 'key2' => $mockObject];
        $expectedArray = ['key1' => [ObjectSerializer::TYPE => 'simple', ObjectSerializer::VALUE => 1], 'key2' => [ObjectSerializer::TYPE => 'object', ObjectSerializer::VALUE => $objectName]];
        $this->assertSame($expectedArray, $objectSerializer->_call('buildStorageArrayForArrayProperty', $arrayProperty));
    }
ObjectSerializerTest