Neos\Flow\Tests\Unit\Persistence\Generic\DataMapperTest::thawPropertiesSetsPropertyValues PHP Метод

thawPropertiesSetsPropertyValues() публичный Метод

    public function thawPropertiesSetsPropertyValues()
    {
        $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' => 'TYPO3\\Post', 'properties' => ['firstProperty' => ['type' => 'string', 'multivalue' => false, 'value' => 'firstValue'], 'secondProperty' => ['type' => 'integer', 'multivalue' => false, 'value' => 1234], 'thirdProperty' => ['type' => 'float', 'multivalue' => false, 'value' => 1.234], 'fourthProperty' => ['type' => 'boolean', 'multivalue' => false, 'value' => false]]];
        $classSchema = new ClassSchema('TYPO3\\Post');
        $classSchema->addProperty('firstProperty', 'string');
        $classSchema->addProperty('secondProperty', 'integer');
        $classSchema->addProperty('thirdProperty', 'float');
        $classSchema->addProperty('fourthProperty', 'boolean');
        $mockReflectionService = $this->createMock(ReflectionService::class);
        $mockReflectionService->expects($this->once())->method('getClassSchema')->will($this->returnValue($classSchema));
        $dataMapper = $this->getAccessibleMock(Persistence\Generic\DataMapper::class, ['dummy']);
        $dataMapper->injectReflectionService($mockReflectionService);
        $dataMapper->_call('thawProperties', $object, 1234, $objectData);
        $this->assertAttributeEquals('firstValue', 'firstProperty', $object);
        $this->assertAttributeEquals(1234, 'secondProperty', $object);
        $this->assertAttributeEquals(1.234, 'thirdProperty', $object);
        $this->assertAttributeEquals(false, 'fourthProperty', $object);
    }