コード例 #1
0
ファイル: EmployeeTest.php プロジェクト: wwsh/gastro-api
 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));
 }
コード例 #2
0
ファイル: EmployeeService.php プロジェクト: wwsh/gastro-api
 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);
 }