/** * @covers \Ilios\CoreBundle\Entity\Course::removeObjective */ public function testRemoveObjectiveWithSessionChildren() { $sessionObjective = m::mock('Ilios\\CoreBundle\\Entity\\Objective'); $session = m::mock('Ilios\\CoreBundle\\Entity\\Session'); $this->object->addSession($session); $courseObjective = m::mock('Ilios\\CoreBundle\\Entity\\Objective'); $courseObjective->shouldReceive('addCourse')->with($this->object)->once(); $courseObjective->shouldReceive('removeCourse')->with($this->object)->once(); $session->shouldReceive('getObjectives')->andReturn([$sessionObjective])->once(); $sessionObjective->shouldReceive('removeParent')->with($courseObjective)->once(); $this->object->addObjective($courseObjective); $this->object->removeObjective($courseObjective); }