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


PHP Date::_SetNow方法代码示例

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


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

示例1: setup

 public function setup()
 {
     parent::setup();
     $this->now = Date::Parse('2011-07-20 13:41:22', 'America/Chicago');
     Date::_SetNow($this->now);
     $this->timezone = $this->now->Timezone();
 }
开发者ID:utn-frm-si,项目名称:booked,代码行数:7,代码来源:Report_RangeTests.php

示例2: setup

 public function setup()
 {
     parent::setup();
     Date::_SetNow(new Date());
     $this->page = new FakeAnnouncementsControl();
     $this->announcements = new FakeAnnouncementRepository();
     $this->presenter = new AnnouncementPresenter($this->page, $this->announcements);
 }
开发者ID:utn-frm-si,项目名称:booked,代码行数:8,代码来源:AnnouncementPresenterTests.php

示例3: setup

 public function setup()
 {
     Date::_SetNow(Date::Now());
     $this->db = new FakeDatabase();
     $this->fakeServer = new FakeServer();
     $this->fakeEmailService = new FakeEmailService();
     $this->fakeConfig = new FakeConfig();
     $this->fakeConfig->SetKey(ConfigKeys::DEFAULT_TIMEZONE, 'America/Chicago');
     $this->fakeResources = new FakeResources();
     $this->fakeUser = $this->fakeServer->UserSession;
     $this->fakePluginManager = new FakePluginManager();
     $this->fileSystem = new FakeFileSystem();
     ServiceLocator::SetDatabase($this->db);
     ServiceLocator::SetServer($this->fakeServer);
     ServiceLocator::SetEmailService($this->fakeEmailService);
     ServiceLocator::SetFileSystem($this->fileSystem);
     Configuration::SetInstance($this->fakeConfig);
     Resources::SetInstance($this->fakeResources);
     PluginManager::SetInstance($this->fakePluginManager);
 }
开发者ID:utn-frm-si,项目名称:booked,代码行数:20,代码来源:TestBase.php

示例4: testGroupsReservations

 public function testGroupsReservations()
 {
     $now = Date::Parse('2011-03-24');
     // thursday
     Date::_SetNow($now);
     $today = new ReservationItemView('1', $now, $now);
     $tomorrow = new ReservationItemView('2', $now->AddDays(1), $now->AddDays(1));
     // friday
     $thisWeek = new ReservationItemView('3', $now->AddDays(2), $now->AddDays(2));
     // saturday
     $nextWeek = new ReservationItemView('3', $now->AddDays(3), $now->AddDays(3));
     // sunday of next week
     $reservations[] = $today;
     $reservations[] = $tomorrow;
     $reservations[] = $thisWeek;
     $reservations[] = $nextWeek;
     $this->repository->expects($this->once())->method('GetReservationList')->with($this->anything(), $this->anything(), $this->anything())->will($this->returnValue($reservations));
     $this->control->expects($this->once())->method('BindToday')->with($this->equalTo(array($today)));
     $this->control->expects($this->once())->method('BindTomorrow')->with($this->equalTo(array($tomorrow)));
     $this->control->expects($this->once())->method('BindThisWeek')->with($this->equalTo(array($thisWeek)));
     $this->control->expects($this->once())->method('BindNextWeek')->with($this->equalTo(array($nextWeek)));
     $presenter = new UpcomingReservationsPresenter($this->control, $this->repository);
     $presenter->PageLoad();
 }
开发者ID:utn-frm-si,项目名称:booked,代码行数:24,代码来源:UpcomingReservationsPresenterTests.php

示例5: testCorrectDatesAreUsedWhenTheUsersTimezoneIsBehindByAWeek

 public function testCorrectDatesAreUsedWhenTheUsersTimezoneIsBehindByAWeek()
 {
     $timezone = 'PST';
     // sunday
     $currentServerDate = Date::Create(2009, 07, 19, 00, 30, 00, 'CST');
     Date::_SetNow($currentServerDate);
     $startDay = 0;
     $daysVisible = 7;
     // previous sunday
     $expectedStart = Date::Create(2009, 07, 12, 00, 00, 00, $timezone);
     $expectedEnd = $expectedStart->AddDays($daysVisible);
     $expectedScheduleDates = new DateRange($expectedStart, $expectedEnd);
     $user = new UserSession(1);
     $user->Timezone = $timezone;
     $this->fakeConfig->SetTimezone('CST');
     $schedule = $this->getMock('ISchedule');
     $schedulePage = $this->getMock('ISchedulePage');
     $schedulePage->expects($this->once())->method('GetSelectedDate')->will($this->returnValue(null));
     $schedule->expects($this->once())->method('GetWeekdayStart')->will($this->returnValue($startDay));
     $schedule->expects($this->once())->method('GetDaysVisible')->will($this->returnValue($daysVisible));
     $pageBuilder = new SchedulePageBuilder();
     $dates = $pageBuilder->GetScheduleDates($user, $schedule, $schedulePage);
     $this->assertEquals($expectedScheduleDates, $dates);
 }
开发者ID:utn-frm-si,项目名称:booked,代码行数:24,代码来源:SchedulePresenterTests.php

示例6: testWhenNotConstrainedByTime

 public function testWhenNotConstrainedByTime()
 {
     $this->fakeConfig->SetSectionKey(ConfigSection::RESERVATION, ConfigKeys::RESERVATION_START_TIME_CONSTRAINT, ReservationStartTimeConstraint::NONE);
     $now = Date::Parse('2011-04-04 12:13:15', 'UTC');
     Date::_SetNow($now);
     $start = Date::Parse('2011-04-04 12:13:14', 'UTC');
     $end = $start->AddDays(5);
     $reservation = new TestReservationSeries();
     $reservation->WithCurrentInstance(new TestReservation('1', new DateRange($start, $end)));
     $rule = new ReservationStartTimeRule($this->scheduleRepository);
     $result = $rule->Validate($reservation);
     $this->assertTrue($result->IsValid());
 }
开发者ID:utn-frm-si,项目名称:booked,代码行数:13,代码来源:ReservationStartTimeRuleTests.php

示例7: teardown

 public function teardown()
 {
     parent::teardown();
     Date::_SetNow(null);
 }
开发者ID:utn-frm-si,项目名称:booked,代码行数:5,代码来源:DashboardPresenterTests.php

示例8: testAddReservationWithOneUserAndOneResource

 public function testAddReservationWithOneUserAndOneResource()
 {
     $seriesId = 100;
     $reservationId = 428;
     $userId = 232;
     $resourceId = 10978;
     $title = 'title';
     $description = 'description';
     $startCst = '2010-02-15 16:30';
     $endCst = '2010-02-16 17:00';
     $duration = DateRange::Create($startCst, $endCst, 'CST');
     $levelId = ReservationUserLevel::OWNER;
     $repeatOptions = new RepeatNone();
     $participantIds = array(2, 9);
     $inviteeIds = array(20, 90);
     $accessory = new ReservationAccessory(928, 3);
     $attribute = new AttributeValue(1, 'value');
     $attachment = new FakeReservationAttachment(1);
     $allowParticipation = true;
     $startUtc = Date::Parse($startCst, 'CST')->ToUtc();
     $endUtc = Date::Parse($endCst, 'CST')->ToUtc();
     $dateCreatedUtc = Date::Parse('2010-01-01 12:14:16', 'UTC');
     Date::_SetNow($dateCreatedUtc);
     $attachmentId = 499;
     $this->db->_ExpectedInsertIds[0] = $seriesId;
     $this->db->_ExpectedInsertIds[1] = $attachmentId;
     $this->db->_ExpectedInsertIds[2] = $reservationId;
     $userSession = new FakeUserSession();
     $reservation = ReservationSeries::Create($userId, new FakeBookableResource($resourceId), $title, $description, $duration, $repeatOptions, $userSession);
     $repeatType = $repeatOptions->RepeatType();
     $repeatOptionsString = $repeatOptions->ConfigurationString();
     $referenceNumber = $reservation->CurrentInstance()->ReferenceNumber();
     $reservation->ChangeParticipants($participantIds);
     $reservation->ChangeInvitees($inviteeIds);
     $reservation->AddAccessory($accessory);
     $reservation->AddAttributeValue($attribute);
     $reservation->AddAttachment($attachment);
     $reservation->AllowParticipation($allowParticipation);
     $this->repository->Add($reservation);
     $insertReservationSeries = new AddReservationSeriesCommand($dateCreatedUtc, $title, $description, $repeatType, $repeatOptionsString, ReservationTypes::Reservation, ReservationStatus::Created, $userId, $allowParticipation);
     $insertReservation = new AddReservationCommand($startUtc, $endUtc, $referenceNumber, $seriesId);
     $insertReservationResource = new AddReservationResourceCommand($seriesId, $resourceId, ResourceLevel::Primary);
     $insertReservationUser = $this->GetAddUserCommand($reservationId, $userId, $levelId);
     $insertReservationAccessory = new AddReservationAccessoryCommand($accessory->AccessoryId, $accessory->QuantityReserved, $seriesId);
     $insertReservationAttribute = new AddAttributeValueCommand($attribute->AttributeId, $attribute->Value, $seriesId, CustomAttributeCategory::RESERVATION);
     $insertParticipant1 = $this->GetAddUserCommand($reservationId, $participantIds[0], ReservationUserLevel::PARTICIPANT);
     $insertParticipant2 = $this->GetAddUserCommand($reservationId, $participantIds[1], ReservationUserLevel::PARTICIPANT);
     $insertInvitee1 = $this->GetAddUserCommand($reservationId, $inviteeIds[0], ReservationUserLevel::INVITEE);
     $insertInvitee2 = $this->GetAddUserCommand($reservationId, $inviteeIds[1], ReservationUserLevel::INVITEE);
     $addAttachment = new AddReservationAttachmentCommand($attachment->FileName(), $attachment->FileType(), $attachment->FileSize(), $attachment->FileExtension(), $seriesId);
     $this->assertEquals(11, count($this->db->_Commands));
     $this->assertEquals($insertReservationSeries, $this->db->_Commands[0]);
     $this->assertEquals($insertReservationResource, $this->db->_Commands[1]);
     $this->assertTrue($this->db->ContainsCommand($insertReservation));
     $this->assertTrue($this->db->ContainsCommand($insertReservationUser));
     $this->assertTrue($this->db->ContainsCommand($insertParticipant1));
     $this->assertTrue($this->db->ContainsCommand($insertParticipant2));
     $this->assertTrue($this->db->ContainsCommand($insertInvitee1));
     $this->assertTrue($this->db->ContainsCommand($insertInvitee2));
     $this->assertTrue($this->db->ContainsCommand($insertReservationAccessory));
     $this->assertTrue($this->db->ContainsCommand($insertReservationAttribute));
     $this->assertTrue($this->db->ContainsCommand($addAttachment));
     $this->assertEquals($attachment->FileContents(), $this->fileSystem->_AddedFileContents);
 }
开发者ID:utn-frm-si,项目名称:booked,代码行数:64,代码来源:ReservationRepositoryTests.php

示例9: testWhenApplyingSimpleUpdatesToFullSeriesAndThereIsNoStartTimeConstraint

 public function testWhenApplyingSimpleUpdatesToFullSeriesAndThereIsNoStartTimeConstraint()
 {
     $this->fakeConfig->SetSectionKey(ConfigSection::RESERVATION, ConfigKeys::RESERVATION_START_TIME_CONSTRAINT, ReservationStartTimeConstraint::NONE);
     $timezone = 'UTC';
     $currentResource = new FakeBookableResource(8);
     $newResource = new FakeBookableResource(10);
     $dateRange = DateRange::Create('2010-01-01 00:00', '2010-01-01 5:00', $timezone);
     Date::_SetNow(Date::Parse('2010-01-05 2:00', $timezone));
     $builder = new ExistingReservationSeriesBuilder();
     $builder->WithPrimaryResource($currentResource);
     $builder->WithCurrentInstance(new TestReservation('1', $dateRange));
     $series = $builder->Build();
     $series->ApplyChangesTo(SeriesUpdateScope::FullSeries);
     $series->Update($series->UserId(), $newResource, 'new', 'new', new FakeUserSession());
     $this->assertEquals($newResource, $series->Resource());
     $this->assertEquals(1, count($series->Instances()));
 }
开发者ID:utn-frm-si,项目名称:booked,代码行数:17,代码来源:ExistingReservationTests.php

示例10: setup

 public function setup()
 {
     parent::setup();
     Date::_SetNow(new Date());
     $this->repository = new AnnouncementRepository();
 }
开发者ID:utn-frm-si,项目名称:booked,代码行数:6,代码来源:AnnouncementRepositoryTests.php


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