public function testMaxNoticeIsCheckedAgainstEachReservationInstanceForEachResource()
 {
     $resource1 = new FakeBookableResource(1, "1");
     $resource1->SetMaxNotice(null);
     $resource2 = new FakeBookableResource(2, "2");
     $resource2->SetMaxNotice("23h00m");
     $reservation = new TestReservationSeries();
     $duration = new DateRange(Date::Now(), Date::Now());
     $tooFarInFuture = Date::Now()->AddDays(1);
     $reservation->WithDuration($duration);
     $reservation->WithRepeatOptions(new RepeatDaily(1, $tooFarInFuture));
     $reservation->WithResource($resource1);
     $reservation->AddResource($resource2);
     $rule = new ResourceMaximumNoticeRule();
     $result = $rule->Validate($reservation);
     $this->assertFalse($result->IsValid());
 }
 public function testValidatesEachDateThatAReservationRepeatsOn()
 {
     $start = Date::Parse('2010-01-01');
     $end = Date::Parse('2010-01-02');
     $reservationDates = new DateRange($start, $end);
     $twoRepetitions = new RepeatWeekly(1, $start->AddDays(14), array($start->Weekday()));
     $repeatDates = $twoRepetitions->GetDates($reservationDates);
     $reservation = new TestReservationSeries();
     $reservation->WithResource(new FakeBookableResource(1));
     $reservation->WithDuration($reservationDates);
     $reservation->WithRepeatOptions($twoRepetitions);
     $strategy = $this->getMock('IResourceAvailabilityStrategy');
     $strategy->expects($this->exactly(1 + count($repeatDates)))->method('GetItemsBetween')->with($this->anything(), $this->anything())->will($this->returnValue(array()));
     $rule = new ResourceAvailabilityRule($strategy, 'UTC');
     $result = $rule->Validate($reservation);
 }