예제 #1
0
 /**
  * @covers Ilios\CoreBundle\Entity\Manager\DepartmentManager::deleteDepartment
  */
 public function testDeleteDepartment()
 {
     $class = 'Ilios\\CoreBundle\\Entity\\Department';
     $em = m::mock('Doctrine\\ORM\\EntityManager')->shouldReceive('persist')->shouldReceive('flush')->mock();
     $repository = m::mock('Doctrine\\ORM\\Repository');
     $registry = m::mock('Doctrine\\Bundle\\DoctrineBundle\\Registry')->shouldReceive('getManagerForClass')->andReturn($em)->shouldReceive('getRepository')->andReturn($repository)->mock();
     $entity = m::mock($class)->shouldReceive('setDeleted')->with(true)->mock();
     $manager = new DepartmentManager($registry, $class);
     $manager->deleteDepartment($entity);
 }