Exemplo n.º 1
0
 /**
  * 1 Insert
  * 2 Update
  * 3 Delete
  */
 public function testSimpleWorkflow()
 {
     $entity = new User();
     $entity->name = "Test string";
     $entity->group_id = 1;
     $entity->dateCreated = new RawValue('NOW()');
     $count = $this->entityManager->getRepository('Model\\User')->count();
     $this->unitOfWork->insert($entity);
     $this->unitOfWork->commit();
     $this->assertInternalType('int', $entity->id);
     $newCount = $this->entityManager->getRepository('Model\\User')->count();
     $count = $count + 1;
     $this->assertSame($count, $newCount);
     $entity->group_id = 2;
     $this->unitOfWork->update($entity);
     $this->unitOfWork->commit();
     $this->assertInternalType('int', $entity->id);
     $newCount = $this->entityManager->getRepository('Model\\User')->count();
     $this->assertSame($count, $newCount);
     $this->unitOfWork->delete($entity);
     $this->unitOfWork->commit();
     $newCount = $this->entityManager->getRepository('Model\\User')->count();
     $this->assertSame($count - 1, $newCount);
 }
Exemplo n.º 2
0
 public function testPrepare()
 {
     $sql = 'SELECT * FROM `users`';
     $this->assertInstanceOf('Lynx\\DBAL\\Driver\\PDO\\Statement', $this->_connection->prepare($sql));
 }