Exemplo n.º 1
0
 private function createShiftType($name)
 {
     $shiftType = ShiftType::registerShiftType($name, new \DateTime(), new \DateTime());
     $current = $this->init->shiftTypeRepo->findOneBy(array('name' => $name));
     if (empty($current)) {
         $this->init->shiftTypeRepo->store($shiftType);
         return $shiftType;
     }
     return $current;
 }
Exemplo n.º 2
0
 public function testShiftCRUD()
 {
     $from = \DateTime::createFromFormat('H:i', '10:00');
     $to = \DateTime::createFromFormat('H:i', '14:00');
     $shiftType = ShiftType::registerShiftType('Test123', $from, $to);
     $this->init->shiftTypeRepo->store($shiftType);
     $this->init->em->flush();
     $find = $this->init->shiftTypeRepo->find($shiftType->getId());
     $this->assertEquals($shiftType, $find);
     $workDay = WorkingDay::registerWorkingDay(new \DateTime());
     $this->init->workingDayRepo->store($workDay);
     $shift = Shift::registerShift($workDay, $shiftType, 12);
     $this->init->shiftRepo->store($shift);
     $this->init->em->flush();
     $find = $this->init->shiftRepo->find($shift->getId());
     $this->assertEquals($shift, $find);
 }
Exemplo n.º 3
0
 /**
  * @param ShiftTypeRegisterDTO $shiftTypeDTO
  * @return ShiftType
  */
 public function registerDTOtoNewShiftType(ShiftTypeRegisterDTO $shiftTypeDTO)
 {
     $shiftType = ShiftType::registerShiftType($shiftTypeDTO->name, $shiftTypeDTO->start, $shiftTypeDTO->end, $shiftTypeDTO->memo);
     return $shiftType;
 }