/**
  * @test
  */
 public function persistentEntityCanBeSerializedToIdentifierUsingObjectSource()
 {
     $entity = new Fixtures\TestEntity();
     $entity->setName('Egon Olsen');
     $entity->setAge(42);
     $entity->setAverageNumberOfKids(3.5);
     $this->persistenceManager->add($entity);
     $entityIdentifier = $this->persistenceManager->getIdentifierByObject($entity);
     $this->persistenceManager->persistAll();
     $this->persistenceManager->clearState();
     $source = $entity;
     $result = $this->propertyMapper->convert($source, 'string');
     $this->assertSame($entityIdentifier, $result);
 }
Ejemplo n.º 2
0
 /**
  * Add and persist a test entity, and return the identifier of the newly created
  * entity.
  *
  * @return string identifier of newly created entity
  */
 protected function createTestEntity()
 {
     $entity = new Fixtures\TestEntity();
     $entity->setName('Egon Olsen');
     $entity->setAge(42);
     $entity->setAverageNumberOfKids(3.5);
     $this->persistenceManager->add($entity);
     $entityIdentifier = $this->persistenceManager->getIdentifierByObject($entity);
     $this->persistenceManager->persistAll();
     $this->persistenceManager->clearState();
     return $entityIdentifier;
 }