/** * @test */ public function commonObjectIsPersistedAndIsReconstituted() { $commonObject = new CommonObject(); $commonObject->setFoo('foo'); $extendedTypesEntity = new ExtendedTypesEntity(); $extendedTypesEntity->setCommonObject($commonObject); $this->persistenceManager->add($extendedTypesEntity); $this->persistenceManager->persistAll(); $this->persistenceManager->clearState(); /** @var ExtendedTypesEntity $persistedExtendedTypesEntity */ $persistedExtendedTypesEntity = $this->extendedTypesEntityRepository->findAll()->getFirst(); $this->assertInstanceOf(\TYPO3\Flow\Tests\Functional\Persistence\Fixtures\ExtendedTypesEntity::class, $persistedExtendedTypesEntity); $this->assertInstanceOf(\TYPO3\Flow\Tests\Functional\Persistence\Fixtures\CommonObject::class, $persistedExtendedTypesEntity->getCommonObject()); $this->assertEquals('foo', $persistedExtendedTypesEntity->getCommonObject()->getFoo()); }
/** * @test */ public function commonObjectIsPersistedAndIsReconstituted() { if ($this->objectManager->get(\TYPO3\Flow\Configuration\ConfigurationManager::class)->getConfiguration(\TYPO3\Flow\Configuration\ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'TYPO3.Flow.persistence.backendOptions.driver') === 'pdo_pgsql') { $this->markTestSkipped('Doctrine ORM on PostgreSQL cannot store serialized data, thus storing objects with Type::OBJECT would fail. See http://www.doctrine-project.org/jira/browse/DDC-3241'); } $commonObject = new CommonObject(); $commonObject->setFoo('foo'); $extendedTypesEntity = new ExtendedTypesEntity(); $extendedTypesEntity->setCommonObject($commonObject); $this->persistenceManager->add($extendedTypesEntity); $this->persistenceManager->persistAll(); $this->persistenceManager->clearState(); /** @var ExtendedTypesEntity $persistedExtendedTypesEntity */ $persistedExtendedTypesEntity = $this->extendedTypesEntityRepository->findAll()->getFirst(); $this->assertInstanceOf(\TYPO3\Flow\Tests\Functional\Persistence\Fixtures\ExtendedTypesEntity::class, $persistedExtendedTypesEntity); $this->assertInstanceOf(\TYPO3\Flow\Tests\Functional\Persistence\Fixtures\CommonObject::class, $persistedExtendedTypesEntity->getCommonObject()); $this->assertEquals('foo', $persistedExtendedTypesEntity->getCommonObject()->getFoo()); }