/** * @test */ public function validationIsEnforcedForParentObject() { $entity = new TestEntity(); $entity->setName('Some Name'); $this->testEntityRepository->add($entity); $subEntity = new SubEntity(); $subEntity->setContent('Sub Entity'); $subEntity->setParentEntity($entity); $entity->addSubEntity($subEntity); $this->persistenceManager->add($subEntity); $this->persistenceManager->persistAll(); $this->persistenceManager->clearState(); $entityIdentifier = $this->persistenceManager->getIdentifierByObject($entity); $subEntityIdentifier = $this->persistenceManager->getIdentifierByObject($subEntity); $invalidArguments = array('entity' => array('__identity' => $entityIdentifier, 'name' => 'xx', 'subEntities' => array(array('__identity' => $subEntityIdentifier, 'content' => 'some valid content')))); $response = $this->browser->request('http://localhost/test/validation/entity/update', 'POST', $invalidArguments); $this->assertSame('An error occurred while trying to call TYPO3\\Flow\\Tests\\Functional\\Mvc\\Fixtures\\Controller\\EntityController->updateAction().' . PHP_EOL . 'Error for entity.name: This field must contain at least 3 characters.' . PHP_EOL, $response->getContent()); }
/** * @test */ public function findByIdentifierReturnsSubTypesOfTheManagedType() { $this->superEntityRepository = $this->objectManager->get('TYPO3\\Flow\\Tests\\Functional\\Persistence\\Fixtures\\SuperEntityRepository'); $subEntity = new SubEntity(); $subEntity->setContent('this is the sub entity'); $this->superEntityRepository->add($subEntity); $identifier = $this->persistenceManager->getIdentifierByObject($subEntity); $this->persistenceManager->persistAll(); $subEntity = $this->superEntityRepository->findByIdentifier($identifier); $this->assertEquals('this is the sub entity', $subEntity->getContent()); }