public function testOpenShiftForToday() { $e = new Employee(); $e->openShiftForToday(); assertThat($e->shiftOpenToday(), is(true)); $e->closeOpenShift(); assertThat($e->shiftOpenToday(), is(false)); $e->openShiftForToday(); assertThat($e->getWorktimes()->count(), is(2)); }
/** * Nitty persister. * * @param $manager * @param $employee */ private function persist(Employee $employee) { $worktimes = $employee->getWorktimes(); foreach ($worktimes as $worktime) { $worktime->setEmployee($employee); $this->manager->persist($worktime); } $this->manager->persist($employee); $this->manager->flush(); }