/** * @test * @author Christopher Hlubek <*****@*****.**> */ public function getObjectByIdentifierLoadsObjectDataFromDocument() { $repository = $this->objectManager->get('TYPO3\\MongoDB\\Tests\\Functional\\Fixtures\\Domain\\Repository\\TestEntityRepository'); $entity = new \TYPO3\MongoDB\Tests\Functional\Fixtures\Domain\Model\TestEntity(); $entity->setName('Foobar'); $repository->add($entity); $persistenceManager = $this->objectManager->get('TYPO3\\FLOW3\\Persistence\\PersistenceManagerInterface'); $persistenceManager->persistAll(); $persistenceSession = $this->objectManager->get('TYPO3\\FLOW3\\Persistence\\Generic\\Session'); $identifier = $persistenceSession->getIdentifierByObject($entity); $persistenceSession->destroy(); $objectData = $this->backend->getObjectDataByIdentifier($identifier, 'TYPO3\\MongoDB\\Tests\\Functional\\Fixtures\\Domain\\Model\\TestEntity'); $this->assertEquals($identifier, $objectData['identifier']); }
/** * Tear down the persistence * * This method is called in functional tests to reset the storage between tests. * The implementation is optional and depends on the underlying persistence backend. * * @return void */ public function tearDown() { if (method_exists($this->backend, 'tearDown')) { $this->backend->tearDown(); } }