setRelatedValueObject() public method

public setRelatedValueObject ( TestValueObject $relatedValueObject ) : void
$relatedValueObject TestValueObject
return void
 /**
  * @test
  */
 public function embeddablesInsideClonedProxiedEntitiesAreCorrectlyLoaded()
 {
     $this->markTestSkipped('This is possibly a bug of Doctrine');
     $entity = new Fixtures\TestEntity();
     $entity->setName('Andi');
     $relatedEntity = new Fixtures\TestEntity();
     $relatedEntity->setName('Robert');
     $embedded = new Fixtures\TestEmbeddable('Foo');
     $relatedEntity->setEmbedded($embedded);
     $valueObject = new Fixtures\TestValueObject('Bar');
     $relatedEntity->setRelatedValueObject($valueObject);
     $entity->setRelatedEntity($relatedEntity);
     $clonedRelatedEntity = clone $entity->getRelatedEntity();
     $this->assertNotNull($clonedRelatedEntity->getEmbedded(), 'Unproxied clone embedded is null');
     $this->testEntityRepository->add($entity);
     $this->testEntityRepository->add($relatedEntity);
     $this->persistenceManager->persistAll();
     $this->persistenceManager->clearState();
     $entityIdentifier = $this->persistenceManager->getIdentifierByObject($entity);
     $loadedEntity = $this->testEntityRepository->findByIdentifier($entityIdentifier);
     $clonedRelatedEntity = clone $loadedEntity->getRelatedEntity();
     $this->assertNotNull($clonedRelatedEntity->getRelatedValueObject(), 'Proxied clone value object is null');
     $this->assertNotNull($clonedRelatedEntity->getEmbedded(), 'Proxied clone embedded is null');
     $this->assertEquals('Foo', $clonedRelatedEntity->getEmbedded()->getValue());
 }
 /**
  * @test
  */
 public function alreadyPersistedValueObjectsAreCorrectlyReused()
 {
     $valueObject1 = new Fixtures\TestValueObject('sameValue');
     $testEntity1 = new Fixtures\TestEntity();
     $testEntity1->setRelatedValueObject($valueObject1);
     $this->testEntityRepository->add($testEntity1);
     $this->persistenceManager->persistAll();
     $this->persistenceManager->clearState();
     $valueObject2 = new Fixtures\TestValueObject('sameValue');
     $testEntity2 = new Fixtures\TestEntity();
     $testEntity2->setRelatedValueObject($valueObject2);
     $valueObject3 = new Fixtures\TestValueObject('sameValue');
     $testEntity3 = new Fixtures\TestEntity();
     $testEntity3->setRelatedValueObject($valueObject3);
     $this->testEntityRepository->add($testEntity2);
     $this->testEntityRepository->add($testEntity3);
     $this->persistenceManager->persistAll();
     $this->persistenceManager->clearState();
     $testEntities = $this->testEntityRepository->findAll();
     $this->assertSame($testEntities[0]->getRelatedValueObject(), $testEntities[1]->getRelatedValueObject());
     $this->assertSame($testEntities[1]->getRelatedValueObject(), $testEntities[2]->getRelatedValueObject());
 }