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)); }
public function logoutEmployee(Employee $employee) { if ($employee->getWorkingNow() === false) { throw new HttpException(412, "Employee was not working"); } else { $this->setStatus(200, 'Employee\'s working shift closed'); } $employee->closeOpenShift(); $employee->setWorkingNow(false); $this->persist($employee); }