Neos\Flow\Tests\Unit\Persistence\Generic\DataMapperTest::thawPropertiesDelegatesHandlingOfArraysAndObjects PHP Method

thawPropertiesDelegatesHandlingOfArraysAndObjects() public method

    public function thawPropertiesDelegatesHandlingOfArraysAndObjects()
    {
        $className = 'Class' . md5(uniqid(mt_rand(), true));
        eval('class ' . $className . ' { public $firstProperty; public $secondProperty; public $thirdProperty; public $fourthProperty; }');
        $object = new $className();
        $objectData = ['identifier' => '1234', 'classname' => 'Neos\\Post', 'properties' => ['firstProperty' => ['type' => 'array', 'multivalue' => true, 'value' => [['type' => 'string', 'index' => 0, 'value' => 'theMappedArray']]], 'secondProperty' => ['type' => 'SplObjectStorage', 'multivalue' => true, 'value' => [['type' => 'Some\\Object', 'index' => null, 'value' => 'theMappedSplObjectStorage']]], 'thirdProperty' => ['type' => 'DateTime', 'multivalue' => false, 'value' => 'theUnixtime'], 'fourthProperty' => ['type' => \Neos\Some\Domain\Model::class, 'multivalue' => false, 'value' => ['identifier' => 'theMappedObjectIdentifier']]]];
        $classSchema = new ClassSchema('Neos\\Post');
        $classSchema->addProperty('firstProperty', 'array');
        $classSchema->addProperty('secondProperty', 'SplObjectStorage');
        $classSchema->addProperty('thirdProperty', 'DateTime');
        $classSchema->addProperty('fourthProperty', \Neos\Some\Domain\Model::class);
        $mockReflectionService = $this->createMock(ReflectionService::class);
        $mockReflectionService->expects($this->once())->method('getClassSchema')->will($this->returnValue($classSchema));
        $dataMapper = $this->getAccessibleMock(Persistence\Generic\DataMapper::class, ['mapDateTime', 'mapArray', 'mapSplObjectStorage', 'mapToObject']);
        $dataMapper->injectReflectionService($mockReflectionService);
        $dataMapper->expects($this->at(0))->method('mapArray')->with($objectData['properties']['firstProperty']['value']);
        $dataMapper->expects($this->at(1))->method('mapSplObjectStorage')->with($objectData['properties']['secondProperty']['value']);
        $dataMapper->expects($this->at(2))->method('mapDateTime')->with($objectData['properties']['thirdProperty']['value']);
        $dataMapper->expects($this->at(3))->method('mapToObject')->with($objectData['properties']['fourthProperty']['value']);
        $dataMapper->_call('thawProperties', $object, $objectData['identifier'], $objectData);
    }