/**
  * @test
  */
 public function canRemoveEntity()
 {
     $expectedConditions = array('id' => 1);
     $this->storage->expects($this->once())->method('deleteWhere')->with($expectedConditions)->will($this->returnValue(1));
     $entity = $this->createEntity();
     $entity->setId(1);
     $this->repository->remove($entity);
     $this->assertEquals(null, $entity->getId());
 }
Esempio n. 2
0
 /**
  * @test
  */
 public function findAllByReturnsCollection()
 {
     $params = array('foo' => 'bar');
     $resultSet = array(array('name' => 'foo', 'value' => 'bar'));
     $this->storage->expects($this->once())->method('findAllBy')->with($params)->will($this->returnValue($resultSet));
     $entities = $this->repository->findAllBy($params);
     $this->assertEquals(array($this->createEntity()), $entities);
 }