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

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

If a property has been removed from a class old data still in the persistence must be skipped when reconstituting.
    public function thawPropertiesSkipsPropertiesNoLongerInClassSchema()
    {
        $className = 'Class' . md5(uniqid(mt_rand(), true));
        eval('class ' . $className . ' { public $firstProperty; public $thirdProperty; }');
        $object = new $className();
        $objectData = ['identifier' => '1234', 'classname' => 'TYPO3\\Post', 'properties' => ['firstProperty' => ['type' => 'string', 'multivalue' => false, 'value' => 'firstValue'], 'secondProperty' => ['type' => 'string', 'multivalue' => false, 'value' => 'secondValue'], 'thirdProperty' => ['type' => 'string', 'multivalue' => false, 'value' => 'thirdValue']]];
        $classSchema = new ClassSchema('TYPO3\\Post');
        $classSchema->addProperty('firstProperty', 'string');
        $classSchema->addProperty('thirdProperty', 'string');
        $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->assertObjectNotHasAttribute('secondProperty', $object);
    }