/** * @covers Ilios\CoreBundle\Entity\Manager\SessionManager::deleteSession */ public function testDeleteSession() { $class = 'Ilios\\CoreBundle\\Entity\\Session'; $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 SessionManager($registry, $class); $manager->deleteSession($entity); }