Exemple #1
0
 /**
  *TimePeriod from start day of month to next start day of month
  *(amount of days = amount of days in this month)
  */
 public function createWorkingDaysForThisMonth()
 {
     /**@var $start \DateTime */
     $start = $this->date;
     $start->modify('first day of this month');
     $end = clone $start;
     $end->modify('first day of next month');
     //interval per day
     $interval = new \DateInterval('P1D');
     $days = new \DatePeriod($start, $interval, $end);
     foreach ($days as $day) {
         $workingDay = WorkingDay::registerWorkingDay($day);
         $this->assignWorkingDay($workingDay);
         $workingDay->assignWorkingMonth($this);
     }
 }
Exemple #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);
 }