当前位置: 首页>>代码示例>>PHP>>正文


PHP DateRange::Create方法代码示例

本文整理汇总了PHP中DateRange::Create方法的典型用法代码示例。如果您正苦于以下问题:PHP DateRange::Create方法的具体用法?PHP DateRange::Create怎么用?PHP DateRange::Create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DateRange的用法示例。


在下文中一共展示了DateRange::Create方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testCreatingNewSeriesSetsAllSharedDataAndCreatesInstances

 public function testCreatingNewSeriesSetsAllSharedDataAndCreatesInstances()
 {
     $userId = 32;
     $resourceId = 10;
     $title = 'Title';
     $description = 'some long decription';
     $tz = 'America/Chicago';
     $userSession = new FakeUserSession();
     $startDateCst = '2010-02-02 12:15';
     $endDateCst = '2010-02-04 17:15';
     $startDateUtc = Date::Parse($startDateCst, $tz)->ToUtc();
     $endDateUtc = Date::Parse($endDateCst, $tz)->ToUtc();
     $dateRange = DateRange::Create($startDateCst, $endDateCst, $tz);
     $repeatedDate = DateRange::Create('2010-01-01', '2010-01-02', 'UTC');
     $repeatOptions = $this->getMock('IRepeatOptions');
     $repeatDates = array($repeatedDate);
     $repeatOptions->expects($this->once())->method('GetDates')->with($this->equalTo($dateRange->ToTimezone($userSession->Timezone)))->will($this->returnValue($repeatDates));
     $resource = new FakeBookableResource($resourceId);
     $series = ReservationSeries::Create($userId, $resource, $title, $description, $dateRange, $repeatOptions, $userSession);
     $this->assertEquals($userId, $series->UserId());
     $this->assertEquals($resource, $series->Resource());
     $this->assertEquals($title, $series->Title());
     $this->assertEquals($description, $series->Description());
     $this->assertTrue($series->IsRecurring());
     $this->assertEquals($repeatOptions, $series->RepeatOptions());
     $instances = array_values($series->Instances());
     $this->assertEquals(count($repeatDates) + 1, count($instances), "should have original plus instances");
     $this->assertTrue($startDateUtc->Equals($instances[0]->StartDate()));
     $this->assertTrue($endDateUtc->Equals($instances[0]->EndDate()));
     $this->assertTrue($repeatedDate->GetBegin()->Equals($instances[1]->StartDate()));
     $this->assertTrue($repeatedDate->GetEnd()->Equals($instances[1]->EndDate()));
 }
开发者ID:utn-frm-si,项目名称:booked,代码行数:32,代码来源:ReservationTests.php

示例2: testLoadsExistingReservationAndUpdatesData

 public function testLoadsExistingReservationAndUpdatesData()
 {
     $seriesId = 109809;
     $expectedSeries = new ExistingReservationSeries();
     $currentDuration = new DateRange(Date::Now()->AddDays(1), Date::Now()->AddDays(2), 'UTC');
     $removedResourceId = 190;
     $resource = new FakeBookableResource(1);
     $additionalId1 = $this->page->resourceIds[0];
     $additionalId2 = $this->page->resourceIds[1];
     $additional1 = new FakeBookableResource($additionalId1);
     $additional2 = new FakeBookableResource($additionalId2);
     $reservation = new Reservation($expectedSeries, $currentDuration);
     $expectedSeries->WithId($seriesId);
     $expectedSeries->WithCurrentInstance($reservation);
     $expectedSeries->WithPrimaryResource($resource);
     $expectedSeries->WithResource(new FakeBookableResource($removedResourceId));
     $expectedSeries->WithAttribute(new AttributeValue(100, 'to be removed'));
     $referenceNumber = $this->page->existingReferenceNumber;
     $timezone = $this->user->Timezone;
     $this->persistenceService->expects($this->once())->method('LoadByReferenceNumber')->with($this->equalTo($referenceNumber))->will($this->returnValue($expectedSeries));
     $this->resourceRepository->expects($this->at(0))->method('LoadById')->with($this->equalTo($this->page->resourceId))->will($this->returnValue($resource));
     $this->resourceRepository->expects($this->at(1))->method('LoadById')->with($this->equalTo($additionalId1))->will($this->returnValue($additional1));
     $this->resourceRepository->expects($this->at(2))->method('LoadById')->with($this->equalTo($additionalId2))->will($this->returnValue($additional2));
     $this->page->repeatType = RepeatType::Daily;
     $roFactory = new RepeatOptionsFactory();
     $repeatOptions = $roFactory->CreateFromComposite($this->page, $this->user->Timezone);
     $expectedDuration = DateRange::Create($this->page->GetStartDate() . " " . $this->page->GetStartTime(), $this->page->GetEndDate() . " " . $this->page->GetEndTime(), $timezone);
     $attachment = new FakeUploadedFile();
     $this->page->attachment = $attachment;
     $this->page->hasEndReminder = false;
     $existingSeries = $this->presenter->BuildReservation();
     $expectedAccessories = array(new ReservationAccessory(1, 2, 'accessoryname'));
     $expectedAttributes = array(1 => new AttributeValue(1, 'something'));
     $this->assertEquals($seriesId, $existingSeries->SeriesId());
     $this->assertEquals($this->page->seriesUpdateScope, $existingSeries->SeriesUpdateScope());
     $this->assertEquals($this->page->title, $existingSeries->Title());
     $this->assertEquals($this->page->description, $existingSeries->Description());
     $this->assertEquals($this->page->userId, $existingSeries->UserId());
     $this->assertEquals($resource, $existingSeries->Resource());
     $this->assertEquals($repeatOptions, $existingSeries->RepeatOptions());
     $this->assertEquals(array($additional1, $additional2), $existingSeries->AdditionalResources());
     $this->assertEquals($this->page->participants, $existingSeries->CurrentInstance()->AddedParticipants());
     $this->assertEquals($this->page->invitees, $existingSeries->CurrentInstance()->AddedInvitees());
     $this->assertTrue($expectedDuration->Equals($existingSeries->CurrentInstance()->Duration()), "Expected: {$expectedDuration} Actual: {$existingSeries->CurrentInstance()->Duration()}");
     $this->assertEquals($this->user, $expectedSeries->BookedBy());
     $this->assertEquals($expectedAccessories, $existingSeries->Accessories());
     $this->assertEquals($expectedAttributes, $existingSeries->AttributeValues());
     $expectedAttachment = ReservationAttachment::Create($attachment->OriginalName(), $attachment->MimeType(), $attachment->Size(), $attachment->Contents(), $attachment->Extension(), $seriesId);
     $this->assertEquals(array($expectedAttachment), $expectedSeries->AddedAttachments());
     $this->assertEquals($this->page->removedFileIds, $existingSeries->RemovedAttachmentIds());
     $this->assertEquals(new ReservationReminder($this->page->GetStartReminderValue(), $this->page->GetStartReminderInterval()), $existingSeries->GetStartReminder());
     $this->assertEquals(ReservationReminder::None(), $existingSeries->GetEndReminder());
 }
开发者ID:utn-frm-si,项目名称:booked,代码行数:53,代码来源:ReservationUpdatePresenterTests.php

示例3: GetReservationDuration

 /**
  * @return DateRange
  */
 private function GetReservationDuration()
 {
     $startDate = $this->_page->GetStartDate();
     $startTime = $this->_page->GetStartTime();
     $endDate = $this->_page->GetEndDate();
     $endTime = $this->_page->GetEndTime();
     $timezone = $this->userSession->Timezone;
     return DateRange::Create($startDate . ' ' . $startTime, $endDate . ' ' . $endTime, $timezone);
 }
开发者ID:hugutux,项目名称:booked,代码行数:12,代码来源:ReservationSavePresenter.php

示例4: BuildDateRange

 private function BuildDateRange($startDate, $startTime, $endDate, $endTime)
 {
     $s = date('Y-m-d', $startDate) . ' ' . $this->MinutesToTime($startTime);
     $e = date('Y-m-d', $endDate) . ' ' . $this->MinutesToTime($endTime);
     return DateRange::Create($s, $e, Configuration::Instance()->GetDefaultTimezone());
 }
开发者ID:richyen,项目名称:gracerms_gpsd,代码行数:6,代码来源:migrate.php

示例5: header

$series = $reservationRepository->LoadByReferenceNumber($params['rn']);
if (!$series) {
    header('HTTP/1.1 404 Not Found', true, 404);
    $response = array('reference_number' => $rn, 'message' => 'Reservation could not be found');
    print json_encode($response);
    return;
}
$series->ApplyChangesTo(SeriesUpdateScope::FullSeries);
if ($params['starts_at'] || $params['ends_at']) {
    if (!$params['starts_at']) {
        $params['starts_at'] = $series->CurrentInstance()->Duration()->GetBegin();
    }
    if (!$params['ends_at']) {
        $params['ends_at'] = $series->CurrentInstance()->Duration()->GetEnd();
    }
    $timing = DateRange::Create($params['starts_at'], $params['ends_at'], $tz);
    $series->UpdateDuration($timing);
}
if ($user->Id() == $series->UserId()) {
    $series->WithOwner($user->Id());
}
$title = $series->Title();
if ($params['summary']) {
    $title = $params['summary'];
}
$description = $series->Description();
if ($params['description']) {
    $description = $params['description'];
}
$series->Update($user->Id(), $resource, $title, $description, $user_session);
$vfactory = new ReservationValidationFactory();
开发者ID:Trideon,项目名称:gigolo,代码行数:31,代码来源:update.php

示例6: json_encode

    print json_encode(array('message' => "You must not set both contact_info and rid"));
    return;
}
if ($contact_info) {
    $resource = $resourceRepository->LoadByContactInfo($contact_info);
} elseif ($rid) {
    $resource = $resourceRepository->LoadByPublicId($rid);
} else {
    header('HTTP/1.1 406 Not Acceptable', true, 406);
    print json_encode(array('message' => "contact_info or rid has to be set"));
    return;
}
/*************************************************
 	date
 *************************************************/
$timing = DateRange::Create($starts_at, $ends_at, $tz);
/*************************************************
 	Action
 *************************************************/
$series = ReservationSeries::Create($user->Id(), $resource, $title, $description, $timing, new RepeatNone(), $user_session);
$reservationAction = ReservationAction::Create;
$pfactory = new ReservationPersistenceFactory();
$persistenceService = $pfactory->Create($reservationAction);
$vfactory = new ReservationValidationFactory();
$validationService = $vfactory->Create($reservationAction, $user_session);
$nfactory = new ReservationNotificationFactory();
$notificationService = $nfactory->Create($reservationAction, $user_session);
#	$handler = new ReservationHandler($persistenceService, $validationService, $notificationService);
$validationResult = $validationService->Validate($series);
$result = $validationResult->CanBeSaved();
if ($result) {
开发者ID:Trideon,项目名称:gigolo,代码行数:31,代码来源:create.php

示例7: testCreationBuildsReservationFromPageData

 public function testCreationBuildsReservationFromPageData()
 {
     $timezone = $this->user->Timezone;
     $userId = $this->page->GetUserId();
     $resourceId = $this->page->GetResourceId();
     $title = $this->page->GetTitle();
     $description = $this->page->GetDescription();
     $startDate = $this->page->GetStartDate();
     $endDate = $this->page->GetEndDate();
     $startTime = $this->page->GetStartTime();
     $endTime = $this->page->GetEndTime();
     $additionalResources = $this->page->GetResources();
     $pageAccessories = $this->page->GetAccessories();
     $pageAttributes = $this->page->GetAttributes();
     $roFactory = new RepeatOptionsFactory();
     $repeatOptions = $roFactory->CreateFromComposite($this->page, $timezone);
     $participants = $this->page->GetParticipants();
     $invitees = $this->page->GetInvitees();
     $attachment = new FakeUploadedFile();
     $this->page->attachment = $attachment;
     $resource = new FakeBookableResource($resourceId, 'r1');
     $additionalResource1 = new FakeBookableResource($additionalResources[0], 'r2');
     $additionalResource2 = new FakeBookableResource($additionalResources[1], 'r3');
     $accessories = array();
     foreach ($pageAccessories as $pa) {
         $accessories[] = new ReservationAccessory($pa->Id, $pa->Quantity, $pa->Name);
     }
     $expectedAttributes = array();
     foreach ($pageAttributes as $attr) {
         $expectedAttributes[] = new AttributeValue($attr->Id, $attr->Value);
     }
     $startReminder = new ReservationReminder($this->page->GetStartReminderValue(), $this->page->GetStartReminderInterval());
     $endReminder = new ReservationReminder($this->page->GetEndReminderValue(), $this->page->GetEndReminderInterval());
     $this->resourceRepository->expects($this->at(0))->method('LoadById')->with($this->equalTo($resourceId))->will($this->returnValue($resource));
     $this->resourceRepository->expects($this->at(1))->method('LoadById')->with($this->equalTo($additionalResources[0]))->will($this->returnValue($additionalResource1));
     $this->resourceRepository->expects($this->at(2))->method('LoadById')->with($this->equalTo($additionalResources[1]))->will($this->returnValue($additionalResource2));
     $duration = DateRange::Create($startDate . ' ' . $startTime, $endDate . ' ' . $endTime, $timezone);
     $actualReservation = $this->presenter->BuildReservation();
     $this->assertEquals($userId, $actualReservation->UserId());
     $this->assertEquals($resourceId, $actualReservation->ResourceId());
     $this->assertEquals($title, $actualReservation->Title());
     $this->assertEquals($description, $actualReservation->Description());
     $this->assertEquals($duration, $actualReservation->CurrentInstance()->Duration());
     $this->assertEquals($repeatOptions, $actualReservation->RepeatOptions());
     $this->assertEquals($participants, $actualReservation->CurrentInstance()->AddedParticipants());
     $this->assertEquals($invitees, $actualReservation->CurrentInstance()->AddedInvitees());
     $this->assertEquals($accessories, $actualReservation->Accessories());
     $this->assertTrue(in_array($expectedAttributes[0], $actualReservation->AttributeValues()));
     $expectedAttachment = ReservationAttachment::Create($attachment->OriginalName(), $attachment->MimeType(), $attachment->Size(), $attachment->Contents(), $attachment->Extension(), 0);
     $this->assertEquals(array($expectedAttachment), $actualReservation->AddedAttachments());
     $this->assertEquals($startReminder, $actualReservation->GetStartReminder());
     $this->assertEquals($endReminder, $actualReservation->GetEndReminder());
 }
开发者ID:utn-frm-si,项目名称:booked,代码行数:53,代码来源:ReservationSavePresenterTests.php

示例8: testRepeatFirstFridayWhenTheFirstDayOfTheMonthIsAFriday

 public function testRepeatFirstFridayWhenTheFirstDayOfTheMonthIsAFriday()
 {
     $firstFriday = DateRange::Create('2014-04-04 08:00', '2014-04-04 08:00', 'UTC');
     $repeat = new RepeatWeekDayOfMonth(1, Date::Parse('2015-01-01', 'UTC'));
     /** @var $dates DateRange[] */
     $dates = $repeat->GetDates($firstFriday);
     $this->assertEquals(1, $dates[3]->GetBegin()->Day());
 }
开发者ID:utn-frm-si,项目名称:booked,代码行数:8,代码来源:RepeatOptionsTests.php

示例9: testNothingIsCheckedIfTimesAreInvalid

 public function testNothingIsCheckedIfTimesAreInvalid()
 {
     $date = DateRange::Create('2011-01-01 00:00:00', '2011-01-01 00:00:00', 'UTC');
     $result = $this->service->Add($date, array(1), 'title', $this->conflictHandler, new RepeatNone());
     $this->assertFalse($result->WasSuccessful());
     $this->assertNotEmpty($result->Message());
 }
开发者ID:utn-frm-si,项目名称:booked,代码行数:7,代码来源:BlackoutsServiceTests.php

示例10: UpdateBlackout

 public function UpdateBlackout()
 {
     $session = ServiceLocator::GetServer()->GetUserSession();
     $id = $this->page->GetUpdateBlackoutId();
     $scope = $this->page->GetSeriesUpdateScope();
     Log::Debug('Updating blackout. BlackoutId=%s, UpdateScope=%s', $id, $scope);
     $resourceIds = $this->page->GetBlackoutResourceIds();
     $startDate = $this->page->GetBlackoutStartDate();
     $startTime = $this->page->GetBlackoutStartTime();
     $endDate = $this->page->GetBlackoutEndDate();
     $endTime = $this->page->GetBlackoutEndTime();
     $blackoutDate = DateRange::Create($startDate . ' ' . $startTime, $endDate . ' ' . $endTime, $session->Timezone);
     $title = $this->page->GetBlackoutTitle();
     $conflictAction = $this->page->GetBlackoutConflictAction();
     $repeatOptionsFactory = new RepeatOptionsFactory();
     $repeatOptions = $repeatOptionsFactory->CreateFromComposite($this->page, $session->Timezone);
     $result = $this->manageBlackoutsService->Update($id, $blackoutDate, $resourceIds, $title, ReservationConflictResolution::Create($conflictAction), $repeatOptions, $scope);
     $this->page->ShowUpdateResult($result->WasSuccessful(), $result->Message(), $result->ConflictingReservations(), $result->ConflictingBlackouts(), $session->Timezone);
 }
开发者ID:Trideon,项目名称:gigolo,代码行数:19,代码来源:ManageBlackoutsPresenter.php

示例11: testDateRangeOccursOnDateIfAnyDateStartsOrEnds

 public function testDateRangeOccursOnDateIfAnyDateStartsOrEnds()
 {
     $range = DateRange::Create('2011-01-01 12:00:00', '2011-01-03 00:00:00', 'UTC');
     $d1 = Date::Parse('2011-01-02 02:02:02', 'UTC');
     $d2 = Date::Parse('2011-01-01 23:59:59', 'UTC');
     $d3 = Date::Parse('2011-01-03 00:00:00', 'UTC');
     $this->assertTrue($range->OccursOn($d1));
     $this->assertTrue($range->OccursOn($d2));
     $this->assertFalse($range->OccursOn($d3));
 }
开发者ID:utn-frm-si,项目名称:booked,代码行数:10,代码来源:DateTests.php

示例12: testBranchedWithMovedAndAddedAndRemovedInstances

 public function testBranchedWithMovedAndAddedAndRemovedInstances()
 {
     $newSeriesId = 10910;
     $newInstanceId1 = 2827;
     $newInstanceId2 = 2828;
     $userId = 10;
     $resourceId = 11;
     $title = "new title";
     $description = "new description";
     $allowParticipation = true;
     $dateRange = DateRange::Create('2010-01-10 05:30:00', '2010-01-10 08:30:00', 'UTC');
     $existingInstance1 = new TestReservation('123', $dateRange->AddDays(1));
     $existingInstance2 = new TestReservation('223', $dateRange->AddDays(2));
     $newInstance1 = new TestReservation('323', $dateRange->AddDays(3));
     $newInstance2 = new TestReservation('423', $dateRange->AddDays(4));
     $removedInstance1 = new TestReservation('523', $dateRange->AddDays(5));
     $removedInstance2 = new TestReservation('623', $dateRange->AddDays(6));
     $currentInstance = new TestReservation('999', $dateRange);
     $builder = new ExistingReservationSeriesBuilder();
     $builder->WithEvent(new InstanceAddedEvent($newInstance1, $builder->series));
     $builder->WithEvent(new InstanceAddedEvent($newInstance2, $builder->series));
     $builder->WithEvent(new InstanceRemovedEvent($removedInstance1, $builder->series));
     $builder->WithEvent(new InstanceRemovedEvent($removedInstance2, $builder->series));
     $builder->WithEvent(new SeriesBranchedEvent($builder->series));
     $builder->WithRequiresNewSeries(true);
     $builder->WithInstance($existingInstance1);
     $builder->WithInstance($existingInstance2);
     $builder->WithCurrentInstance($currentInstance);
     $existingReservation = $builder->BuildTestVersion();
     $existingReservation->Update($userId, new FakeBookableResource($resourceId), $title, $description, new FakeUserSession());
     $existingReservation->AllowParticipation($allowParticipation);
     $expectedRepeat = $existingReservation->RepeatOptions();
     $this->db->_ExpectedInsertIds[] = $newSeriesId;
     $this->db->_ExpectedInsertIds[] = $newInstanceId1;
     $this->db->_ExpectedInsertIds[] = $newInstanceId2;
     $this->repository->Update($existingReservation);
     $addNewSeriesCommand = new AddReservationSeriesCommand(Date::Now(), $title, $description, $expectedRepeat->RepeatType(), $expectedRepeat->ConfigurationString(), ReservationTypes::Reservation, ReservationStatus::Created, $userId, $allowParticipation);
     $updateReservationCommand1 = $this->GetUpdateReservationCommand($newSeriesId, $existingInstance1);
     $updateReservationCommand2 = $this->GetUpdateReservationCommand($newSeriesId, $existingInstance2);
     $updateReservationCommand3 = $this->GetUpdateReservationCommand($newSeriesId, $currentInstance);
     $addReservationCommand1 = $this->GetAddReservationCommand($newSeriesId, $newInstance1);
     $addReservationCommand2 = $this->GetAddReservationCommand($newSeriesId, $newInstance2);
     $insertReservationUser1 = $this->GetAddUserCommand($newInstanceId1, $userId, ReservationUserLevel::OWNER);
     $insertReservationUser2 = $this->GetAddUserCommand($newInstanceId2, $userId, ReservationUserLevel::OWNER);
     $removeReservationCommand1 = new RemoveReservationCommand($removedInstance1->ReferenceNumber());
     $removeReservationCommand2 = new RemoveReservationCommand($removedInstance2->ReferenceNumber());
     $this->assertEquals($addNewSeriesCommand, $this->db->_Commands[0]);
     $commands = $this->db->GetCommandsOfType('UpdateReservationCommand');
     $this->assertEquals(3, count($commands));
     $addUserCommands = $this->db->GetCommandsOfType('AddReservationUserCommand');
     $this->assertEquals(2, count($addUserCommands));
     $this->assertTrue(in_array($updateReservationCommand1, $this->db->_Commands));
     $this->assertTrue(in_array($updateReservationCommand2, $this->db->_Commands));
     $this->assertTrue(in_array($updateReservationCommand3, $this->db->_Commands));
     $this->assertTrue(in_array($addReservationCommand1, $this->db->_Commands));
     $this->assertTrue(in_array($addReservationCommand2, $this->db->_Commands));
     $this->assertTrue(in_array($insertReservationUser1, $this->db->_Commands));
     $this->assertTrue(in_array($insertReservationUser2, $this->db->_Commands));
     $this->assertTrue(in_array($removeReservationCommand1, $this->db->_Commands));
     $this->assertTrue(in_array($removeReservationCommand2, $this->db->_Commands));
 }
开发者ID:utn-frm-si,项目名称:booked,代码行数:61,代码来源:ReservationRepositoryTests.php

示例13: testUpdatesBlackout

 public function testUpdatesBlackout()
 {
     $startDate = '1/1/2011';
     $endDate = '1/2/2011';
     $startTime = '01:30 PM';
     $endTime = '12:15 AM';
     $timezone = $this->fakeUser->Timezone;
     $dr = DateRange::Create($startDate . ' ' . $startTime, $endDate . ' ' . $endTime, $timezone);
     $title = 'out of service';
     $conflictAction = ReservationConflictResolution::Delete;
     $conflictResolution = ReservationConflictResolution::Create($conflictAction);
     $endDateString = '2012-01-01';
     $repeatType = RepeatType::Daily;
     $repeatInterval = 1;
     $repeatDays = array(1, 2);
     $repeatMonthlyType = RepeatMonthlyType::DayOfMonth;
     $blackoutInstanceId = 1111;
     $scope = SeriesUpdateScope::ThisInstance;
     $roFactory = new RepeatOptionsFactory();
     $repeatEndDate = Date::Parse($endDateString, $timezone);
     $repeatOptions = $roFactory->Create($repeatType, $repeatInterval, $repeatEndDate, $repeatDays, $repeatMonthlyType);
     $this->ExpectPageToReturnCommonBlackoutInfo($startDate, $startTime, $endDate, $endTime, $title, $conflictAction);
     $this->ExpectPageToReturnRepeatInfo($repeatType, $repeatInterval, $endDateString, $repeatDays, $repeatMonthlyType);
     $resourceIds = array(123, 456);
     $this->page->expects($this->once())->method('GetBlackoutResourceIds')->will($this->returnValue($resourceIds));
     $this->page->expects($this->once())->method('GetUpdateBlackoutId')->will($this->returnValue($blackoutInstanceId));
     $this->page->expects($this->once())->method('GetSeriesUpdateScope')->will($this->returnValue($scope));
     $result = $this->getMock('IBlackoutValidationResult');
     $this->blackoutsService->expects($this->once())->method('Update')->with($this->equalTo($blackoutInstanceId), $this->equalTo($dr), $this->equalTo($resourceIds), $this->equalTo($title), $this->equalTo($conflictResolution), $this->equalTo($repeatOptions), $this->equalTo($scope))->will($this->returnValue($result));
     $this->presenter->UpdateBlackout();
 }
开发者ID:utn-frm-si,项目名称:booked,代码行数:31,代码来源:ManageBlackoutsPresenterTests.php

示例14: testChangingTimeForFullSeriesUpdatesAllInstanceTimes

 public function testChangingTimeForFullSeriesUpdatesAllInstanceTimes()
 {
     $repeatOptions = new RepeatDaily(1, Date::Now());
     $dateRange = DateRange::Create('2015-01-01 08:30', '2015-01-01 09:30', 'UTC');
     $instance1Date = $dateRange->AddDays(5);
     $instance2Date = $dateRange->AddDays(8);
     $instance1 = new TestReservation('123', $instance1Date, 100);
     $builder = new ExistingReservationSeriesBuilder();
     $builder->WithBookedBy(new FakeUserSession(true));
     $builder->WithRepeatOptions($repeatOptions);
     $builder->WithInstance($instance1);
     $builder->WithInstance(new TestReservation('223', $instance2Date, 101));
     $builder->WithCurrentInstance(new TestReservation('1', $dateRange, 102));
     $series = $builder->Build();
     $series->ApplyChangesTo(SeriesUpdateScope::FullSeries);
     $newDuration = DateRange::Create('2015-01-01 09:30:00', '2015-01-02 00:00:00', 'UTC');
     $series->UpdateDuration($newDuration);
     $this->assertEquals($newDuration, $series->CurrentInstance()->Duration());
     $newInstance1Start = Date::Parse('2015-01-06 09:30:00', 'UTC');
     $newInstance1End = Date::Parse('2015-01-07 00:00:00', 'UTC');
     $newInstance2Start = Date::Parse('2015-01-09 09:30:00', 'UTC');
     $newInstance2End = Date::Parse('2015-01-10 00:00:00', 'UTC');
     //		$this->assertEquals(new DateRange($newInstance1Start, $newInstance1End), $series->GetInstance($newInstance1Start)->Duration());
     //		$this->assertEquals(new DateRange($newInstance2Start, $newInstance2End), $series->GetInstance($newInstance2Start)->Duration());
     $events = $series->GetEvents();
     $this->assertTrue(in_array(new InstanceUpdatedEvent($instance1, $series), $events));
 }
开发者ID:utn-frm-si,项目名称:booked,代码行数:27,代码来源:ExistingReservationTests.php


注:本文中的DateRange::Create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。