public function testLogoutEmployee() { $employee = new Employee(); $employee->setWorkingNow(false); $this->tested->loginEmployee($employee); $this->tested->logoutEmployee($employee); assertThat($employee->getWorkingNow(), is(false)); assertThat($this->tested->getCode(), is(200)); assertThat($this->tested->getMessage(), is('Employee\'s working shift closed')); }
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); }