/** * @test */ public function aopIsCorrectlyInitializedEvenIfADoctrineProxyGetsInitializedOnTheFlyFromTheOutside() { $entity = new Fixtures\TestEntity(); $entity->setName('Andi'); $relatedEntity = new Fixtures\TestEntity(); $relatedEntity->setName('Robert'); $entity->setRelatedEntity($relatedEntity); $this->testEntityRepository->add($entity); $this->testEntityRepository->add($relatedEntity); $this->persistenceManager->persistAll(); $this->persistenceManager->clearState(); $entityIdentifier = $this->persistenceManager->getIdentifierByObject($entity); $loadedEntity = $this->testEntityRepository->findByIdentifier($entityIdentifier); $this->testEntityRepository->findOneByName('Robert'); $loadedRelatedEntity = $loadedEntity->getRelatedEntity(); $this->assertEquals($loadedRelatedEntity->sayHello(), 'Hello Andi!'); }
/** * @test */ public function validationIsOnlyDoneForPropertiesWhichAreInTheDefaultOrPersistencePropertyGroup() { $this->removeExampleEntities(); $this->insertExampleEntity(); $this->persistenceManager->persistAll(); $testEntity = $this->testEntityRepository->findOneByName('Flow'); // We now make the TestEntities Description *invalid*, and still // expect that the saving works without exception. $testEntity->setDescription(''); $this->testEntityRepository->update($testEntity); $this->persistenceManager->persistAll(); // dummy assertion to suppress PHPUnit warning $this->assertTrue(true); }