/**
  * @test
  */
 public function findAllReturnsQueryResult()
 {
     $this->postRepository = $this->objectManager->get('TYPO3\\Flow\\Tests\\Functional\\Persistence\\Fixtures\\PostRepository');
     $this->assertInstanceOf('TYPO3\\Flow\\Persistence\\Doctrine\\Repository', $this->postRepository, 'Repository under test should be a Doctrine Repository');
     $result = $this->postRepository->findAll();
     $this->assertInstanceOf('TYPO3\\Flow\\Persistence\\QueryResultInterface', $result, 'findAll should return a QueryResult object');
 }
 /**
  * @test
  */
 public function entitiesWithOwnRepositoryAreNotRemovedIfRelatedRootEntityIsRemoved()
 {
     $comment = new Comment();
     $this->commentRepository->add($comment);
     $post = new Post();
     $post->setComment($comment);
     $this->postRepository->add($post);
     $this->persistenceManager->persistAll();
     $commentIdentifier = $this->persistenceManager->getIdentifierByObject($comment);
     $retrievedComment = $this->persistenceManager->getObjectByIdentifier($commentIdentifier, 'TYPO3\\Flow\\Tests\\Functional\\Persistence\\Fixtures\\Comment');
     $this->assertSame($comment, $retrievedComment);
     $this->postRepository->remove($post);
     $this->persistenceManager->persistAll();
     $retrievedComment = $this->persistenceManager->getObjectByIdentifier($commentIdentifier, 'TYPO3\\Flow\\Tests\\Functional\\Persistence\\Fixtures\\Comment');
     $this->assertSame($comment, $retrievedComment);
 }
 /**
  * This test fixes FLOW-296 but is only affecting MySQL.
  *
  * @test
  */
 public function valueObjectsAreNotCascadeRemovedWhenARelatedEntityIsDeleted()
 {
     $post1 = new Post();
     $post1->setAuthor(new TestValueObject('Some Name'));
     $post2 = new Post();
     $post2->setAuthor(new TestValueObject('Some Name'));
     $this->postRepository->add($post1);
     $this->postRepository->add($post2);
     $this->persistenceManager->persistAll();
     $this->postRepository->remove($post1);
     $this->persistenceManager->persistAll();
     // if all goes well the value object is not deleted
     $this->assertTrue(true);
 }