function test3() { TimeSource::mock(2013, 3, 1, 9, 0, 0); $event = new EventModel(); $event->setStartAt($this->mktime(2013, 3, 1, 19, 0, 0)); $event->setEndAt($this->mktime(2013, 3, 1, 21, 0, 0)); $eventSet = new EventRecurSetModel(); $eventSet->setTimeZoneName('Europe/London'); $newEvents = $eventSet->getNewWeeklyEvents($event, 60); $this->assertTrue(count($newEvents) >= 8); $this->assertEquals($this->mktime(2013, 3, 8, 19, 0, 0)->format('r'), $newEvents[0]->getStartAt()->format('r')); $this->assertEquals($this->mktime(2013, 3, 8, 21, 0, 0)->format('r'), $newEvents[0]->getEndAt()->format('r')); $this->assertEquals($this->mktime(2013, 3, 15, 19, 0, 0)->format('r'), $newEvents[1]->getStartAt()->format('r')); $this->assertEquals($this->mktime(2013, 3, 15, 21, 0, 0)->format('r'), $newEvents[1]->getEndAt()->format('r')); $this->assertEquals($this->mktime(2013, 3, 22, 19, 0, 0)->format('r'), $newEvents[2]->getStartAt()->format('r')); $this->assertEquals($this->mktime(2013, 3, 22, 21, 0, 0)->format('r'), $newEvents[2]->getEndAt()->format('r')); $this->assertEquals($this->mktime(2013, 3, 29, 19, 0, 0)->format('r'), $newEvents[3]->getStartAt()->format('r')); $this->assertEquals($this->mktime(2013, 3, 29, 21, 0, 0)->format('r'), $newEvents[3]->getEndAt()->format('r')); ### at his point DST kicks in and since we are getting data times (in UTC) they shifn by an hour. $this->assertEquals($this->mktime(2013, 4, 5, 18, 0, 0)->format('r'), $newEvents[4]->getStartAt()->format('r')); $this->assertEquals($this->mktime(2013, 4, 5, 20, 0, 0)->format('r'), $newEvents[4]->getEndAt()->format('r')); $this->assertEquals($this->mktime(2013, 4, 12, 18, 0, 0)->format('r'), $newEvents[5]->getStartAt()->format('r')); $this->assertEquals($this->mktime(2013, 4, 12, 20, 0, 0)->format('r'), $newEvents[5]->getEndAt()->format('r')); $this->assertEquals($this->mktime(2013, 4, 19, 18, 0, 0)->format('r'), $newEvents[6]->getStartAt()->format('r')); $this->assertEquals($this->mktime(2013, 4, 19, 20, 0, 0)->format('r'), $newEvents[6]->getEndAt()->format('r')); $this->assertEquals($this->mktime(2013, 4, 26, 18, 0, 0)->format('r'), $newEvents[7]->getStartAt()->format('r')); $this->assertEquals($this->mktime(2013, 4, 26, 20, 0, 0)->format('r'), $newEvents[7]->getEndAt()->format('r')); }
function testCustomFieldChange1() { TimeSource::mock(2012, 7, 1, 7, 0, 0); $customFieldDefinition1 = new EventCustomFieldDefinitionModel(); $customFieldDefinition1->setId(1); $customFieldDefinition1->setExtensionId('org.openacalendar'); $customFieldDefinition1->setType('TextSingleLine'); $customFieldDefinition1->setKey('cats'); $customFieldDefinition1->setLabel('cats'); $event = new EventModel(); $event->setStartAt(getUTCDateTime(2012, 6, 13, 19, 0, 0)); $event->setEndAt(getUTCDateTime(2012, 6, 13, 21, 0, 0)); $event->setSummary("Event Please"); $event->setCustomField($customFieldDefinition1, "MANY"); $eventSet = new EventRecurSetModel(); $eventSet->setTimeZoneName('Europe/London'); $eventSet->setCustomFields(array($customFieldDefinition1)); $newEvents = $eventSet->getNewMonthlyEventsOnSetDayInWeek($event, 6 * 31); $this->assertTrue(count($newEvents) >= 6); $this->assertTrue($newEvents[0]->hasCustomField($customFieldDefinition1)); $this->assertEquals("MANY", $newEvents[0]->getCustomField($customFieldDefinition1)); $this->assertTrue($newEvents[1]->hasCustomField($customFieldDefinition1)); $this->assertEquals("MANY", $newEvents[1]->getCustomField($customFieldDefinition1)); $this->assertTrue($newEvents[2]->hasCustomField($customFieldDefinition1)); $this->assertEquals("MANY", $newEvents[2]->getCustomField($customFieldDefinition1)); $this->assertTrue($newEvents[3]->hasCustomField($customFieldDefinition1)); $this->assertEquals("MANY", $newEvents[3]->getCustomField($customFieldDefinition1)); // DST shift happens here! The cats do not care. $this->assertTrue($newEvents[4]->hasCustomField($customFieldDefinition1)); $this->assertEquals("MANY", $newEvents[4]->getCustomField($customFieldDefinition1)); $this->assertTrue($newEvents[5]->hasCustomField($customFieldDefinition1)); $this->assertEquals("MANY", $newEvents[5]->getCustomField($customFieldDefinition1)); }
/** * @dataProvider dataForTestIsDateToLateForArbitraryDate */ function testIsDateToLateForArbitraryDate($year, $month, $day, $days, $result) { $timeSource = new \TimeSource(); $timeSource->mock(2015, 03, 01, 10, 0, 0); $eventSet = new EventRecurSetModel(); $eventSet->setTimeZoneName('Europe/London'); $newDate = new \DateTime(); $newDate->setDate($year, $month, $day); $this->assertEquals($result, $eventSet->isDateToLateForArbitraryDate($newDate, $timeSource, $days)); }
public function getForImportedEvent(ImportedEventModel $importedEventModel) { global $DB; $stat = $DB->prepare("SELECT event_recur_set.* FROM event_recur_set " . " JOIN event_information ON event_information.event_recur_set_id = event_recur_set.id " . " JOIN imported_event_is_event ON imported_event_is_event.event_id = event_information.id " . " WHERE imported_event_is_event.imported_event_id = :id"); $stat->execute(array('id' => $importedEventModel->getId())); if ($stat->rowCount() > 0) { $ers = new EventRecurSetModel(); $ers->setFromDataBaseRow($stat->fetch()); return $ers; } }
public function run(ImportedEventOccurrenceModel $importedEventOccurrenceModel) { $eventRepo = new EventRepository(); $eventRecurSetRepo = new EventRecurSetRepository(); if ($importedEventOccurrenceModel->hasReoccurence()) { // Have to load it looking for the right time to! $event = $this->loadEventForImportedReoccurredEvent($importedEventOccurrenceModel); } else { // just load it. $event = $this->loadEventForImportedEvent($importedEventOccurrenceModel); } if ($event) { $this->eventsSeenIDs[] = $event->getId(); // Set Existing Event From Import Event URL if ($importedEventOccurrenceModel->getIsDeleted()) { if (!$event->getIsDeleted()) { $eventRepo->delete($event); return true; } } else { if ($event->setFromImportedEventModel($importedEventOccurrenceModel) || $event->getIsDeleted()) { $event->setIsDeleted(false); $eventRepo->edit($event); return true; } } } else { if (!$this->importURL->getIsManualEventsCreation()) { // New Event From Import Event URL $event = $this->newEventFromImportedEventModel($importedEventOccurrenceModel); if ($this->eventRecurSet) { $event->setEventRecurSetId($this->eventRecurSet->getId()); } $eventRepo->create($event, $this->site, null, $this->group, null, $importedEventOccurrenceModel); $this->eventsSeenIDs[] = $event->getId(); if (!$this->eventRecurSet && $this->makeEventRecurSetIfNone) { $this->eventRecurSet = $eventRecurSetRepo->getForEvent($event); } return true; } else { return false; } } return false; }
function recur($slug, Request $request, Application $app) { if (!$this->build($slug, $request, $app)) { $app->abort(404, "Event does not exist."); } if ($this->parameters['event']->getIsDeleted()) { die("No"); // TODO } if ($this->parameters['event']->getIsImported()) { die("No"); // TODO } if (!$this->parameters['group']) { // Existing Group // TODO csfr if ($request->request->get('intoGroupSlug')) { $groupRepo = new GroupRepository(); $group = $groupRepo->loadBySlug($app['currentSite'], $request->request->get('intoGroupSlug')); if ($group) { $groupRepo->addEventToGroup($this->parameters['event'], $group); $repo = new UserWatchesGroupRepository(); $repo->startUserWatchingGroupIfNotWatchedBefore($app['currentUser'], $group); return $app->redirect("/event/" . $this->parameters['event']->getSlugForURL() . "/recur/"); } } // New group if ($request->request->get('NewGroupTitle') && $request->request->get('CSFRToken') == $app['websession']->getCSFRToken()) { $group = new GroupModel(); $group->setTitle($request->request->get('NewGroupTitle')); $groupRepo = new GroupRepository(); $groupRepo->create($group, $app['currentSite'], $app['currentUser']); $groupRepo->addEventToGroup($this->parameters['event'], $group); return $app->redirect("/event/" . $this->parameters['event']->getSlugForURL() . "/recur/"); } return $app['twig']->render('site/event/recur.groupneeded.html.twig', $this->parameters); } else { $eventRecurSet = new EventRecurSetModel(); $eventRecurSet->setTimeZoneName($this->parameters['event']->getTimezone()); $data = $eventRecurSet->getEventPatternData($this->parameters['event']); if ($data['weekInMonth'] < 5) { $this->parameters['recurMonthlyOnWeekNumber'] = $data['weekInMonth']; $ordinal = array(1 => 'st', 2 => 'nd', 3 => 'rd', 4 => 'th'); $this->parameters['recurMonthlyOnWeekNumberOrdinal'] = $ordinal[$data['weekInMonth']]; } else { $this->parameters['recurMonthlyOnWeekNumber'] = null; $this->parameters['recurMonthlyOnWeekNumberOrdinal'] = null; } $this->parameters['recurMonthlyOnLastWeek'] = $data['isLastWeekInMonth']; return $app['twig']->render('site/event/recur.html.twig', $this->parameters); } }
function testChangCustomField1() { TimeSource::mock(2014, 1, 1, 9, 0, 0); $customFieldDefinition1 = new EventCustomFieldDefinitionModel(); $customFieldDefinition1->setId(1); $customFieldDefinition1->setExtensionId('org.openacalendar'); $customFieldDefinition1->setType('TextSingleLine'); $customFieldDefinition1->setKey('cats'); $customFieldDefinition1->setLabel('cats'); $eventSet = new EventRecurSetModel(); $eventSet->setTimeZoneName('Europe/London'); $eventSet->setCustomFields(array($customFieldDefinition1)); $initialEvent = new EventModel(); $initialEvent->setSlug(1); $initialEvent->setCustomField($customFieldDefinition1, "Dogs go miaow"); // this is the inital wrong value $initialEvent->setStartAt(getUTCDateTime(2014, 1, 7, 19, 0, 0)); $initialEvent->setEndAt(getUTCDateTime(2014, 1, 7, 21, 0, 0)); $eventSet->setInitialEventJustBeforeLastChange($initialEvent); $initialEventEdited = clone $initialEvent; $initialEventEdited->setCustomField($customFieldDefinition1, "Dogs go woof"); // this is the later corrected value $eventSet->setInitalEvent($initialEventEdited); $futureEvent1 = new EventModel(); $futureEvent1->setSlug(2); $futureEvent1->setCustomField($customFieldDefinition1, "Dogs go miaow"); // this is the earlier wrong value that we will want to overwrite $futureEvent1->setStartAt(getUTCDateTime(2014, 1, 14, 19, 0, 0)); $futureEvent1->setEndAt(getUTCDateTime(2014, 1, 14, 21, 0, 0)); $futureEvent2 = new EventModel(); $futureEvent2->setSlug(3); $futureEvent2->setCustomField($customFieldDefinition1, "Dogs go woof"); // this value has already been corrected $futureEvent2->setStartAt(getUTCDateTime(2014, 1, 21, 19, 0, 0)); $futureEvent2->setEndAt(getUTCDateTime(2014, 1, 21, 21, 0, 0)); $futureEvent3 = new EventModel(); $futureEvent3->setSlug(4); $futureEvent3->setCustomField($customFieldDefinition1, "Dogs go miaowwwwwwww"); // this value has already been edited. Possible to overwrite but not recommended $futureEvent3->setStartAt(getUTCDateTime(2014, 1, 21, 19, 0, 0)); $futureEvent3->setEndAt(getUTCDateTime(2014, 1, 21, 21, 0, 0)); $eventSet->setFutureEvents(array($futureEvent1, $futureEvent2, $futureEvent3)); $eventHistory = new \models\EventHistoryModel(); $eventHistory->setFromDataBaseRow(array('event_id' => null, 'summary' => null, 'description' => null, 'start_at' => null, 'end_at' => null, 'created_at' => null, 'is_deleted' => null, 'is_cancelled' => null, 'country_id' => null, 'timezone' => null, 'venue_id' => null, 'url' => null, 'ticket_url' => null, 'is_virtual' => null, 'is_physical' => null, 'area_id' => null, 'user_account_id' => null, 'summary_changed' => '-1', 'description_changed' => '-1', 'start_at_changed' => '-1', 'end_at_changed' => '-1', 'is_deleted_changed' => '-1', 'country_id_changed' => '-1', 'timezone_changed' => '-1', 'venue_id_changed' => '-1', 'url_changed' => '-1', 'is_virtual_changed' => '-1', 'is_physical_changed' => '-1', 'area_id_changed' => '-1', 'is_new' => '-1', 'custom_fields' => json_encode(array('1' => 'Dogs go woof')), 'custom_fields_changed' => json_encode(array('1' => 1)))); $eventSet->setInitalEventLastChange($eventHistory); ## Detect !!! $eventSet->applyChangeToFutureEvents(); ## Test Changes Picked Up $proposedChanges1 = $eventSet->getFutureEventsProposedChangesForEventSlug($futureEvent1->getSlug()); $this->assertEquals(false, $proposedChanges1->getSummaryChangePossible()); $this->assertEquals(false, $proposedChanges1->getSummaryChangeSelected()); $this->assertEquals(false, $proposedChanges1->getDescriptionChangePossible()); $this->assertEquals(false, $proposedChanges1->getDescriptionChangeSelected()); $this->assertEquals(false, $proposedChanges1->getTimezoneChangePossible()); $this->assertEquals(false, $proposedChanges1->getTimezoneChangeSelected()); $this->assertEquals(false, $proposedChanges1->getCountryAreaVenueIdChangePossible()); $this->assertEquals(false, $proposedChanges1->getCountryAreaVenueIdChangeSelected()); $this->assertEquals(false, $proposedChanges1->getUrlChangePossible()); $this->assertEquals(false, $proposedChanges1->getUrlChangeSelected()); $this->assertEquals(false, $proposedChanges1->getIsVirtualChangePossible()); $this->assertEquals(false, $proposedChanges1->getIsVirtualChangeSelected()); $this->assertEquals(false, $proposedChanges1->getIsPhysicalChangePossible()); $this->assertEquals(false, $proposedChanges1->getIsPhysicalChangeSelected()); $this->assertEquals(false, $proposedChanges1->getStartEndAtChangePossible()); $this->assertEquals(false, $proposedChanges1->getStartEndAtChangeSelected()); $this->assertEquals(true, $proposedChanges1->getCustomFieldChangePossible($customFieldDefinition1)); $this->assertEquals(true, $proposedChanges1->getCustomFieldChangeSelected($customFieldDefinition1)); $proposedChanges2 = $eventSet->getFutureEventsProposedChangesForEventSlug($futureEvent2->getSlug()); $this->assertEquals(false, $proposedChanges2->getSummaryChangePossible()); $this->assertEquals(false, $proposedChanges2->getSummaryChangeSelected()); $this->assertEquals(false, $proposedChanges2->getDescriptionChangePossible()); $this->assertEquals(false, $proposedChanges2->getDescriptionChangeSelected()); $this->assertEquals(false, $proposedChanges2->getTimezoneChangePossible()); $this->assertEquals(false, $proposedChanges2->getTimezoneChangeSelected()); $this->assertEquals(false, $proposedChanges2->getCountryAreaVenueIdChangePossible()); $this->assertEquals(false, $proposedChanges2->getCountryAreaVenueIdChangeSelected()); $this->assertEquals(false, $proposedChanges2->getUrlChangePossible()); $this->assertEquals(false, $proposedChanges2->getUrlChangeSelected()); $this->assertEquals(false, $proposedChanges2->getIsVirtualChangePossible()); $this->assertEquals(false, $proposedChanges2->getIsVirtualChangeSelected()); $this->assertEquals(false, $proposedChanges2->getIsPhysicalChangePossible()); $this->assertEquals(false, $proposedChanges2->getIsPhysicalChangeSelected()); $this->assertEquals(false, $proposedChanges2->getStartEndAtChangePossible()); $this->assertEquals(false, $proposedChanges2->getStartEndAtChangeSelected()); $this->assertEquals(false, $proposedChanges2->isAnyChangesPossible()); $this->assertEquals(false, $proposedChanges2->getCustomFieldChangePossible($customFieldDefinition1)); $this->assertEquals(false, $proposedChanges2->getCustomFieldChangeSelected($customFieldDefinition1)); $proposedChanges3 = $eventSet->getFutureEventsProposedChangesForEventSlug($futureEvent3->getSlug()); $this->assertEquals(false, $proposedChanges3->getSummaryChangePossible()); $this->assertEquals(false, $proposedChanges3->getSummaryChangeSelected()); $this->assertEquals(false, $proposedChanges3->getDescriptionChangePossible()); $this->assertEquals(false, $proposedChanges3->getDescriptionChangeSelected()); $this->assertEquals(false, $proposedChanges3->getTimezoneChangePossible()); $this->assertEquals(false, $proposedChanges3->getTimezoneChangeSelected()); $this->assertEquals(false, $proposedChanges3->getCountryAreaVenueIdChangePossible()); $this->assertEquals(false, $proposedChanges3->getCountryAreaVenueIdChangeSelected()); $this->assertEquals(false, $proposedChanges3->getUrlChangePossible()); $this->assertEquals(false, $proposedChanges3->getUrlChangeSelected()); $this->assertEquals(false, $proposedChanges3->getIsVirtualChangePossible()); $this->assertEquals(false, $proposedChanges3->getIsVirtualChangeSelected()); $this->assertEquals(false, $proposedChanges3->getIsPhysicalChangePossible()); $this->assertEquals(false, $proposedChanges3->getIsPhysicalChangeSelected()); $this->assertEquals(false, $proposedChanges3->getStartEndAtChangePossible()); $this->assertEquals(false, $proposedChanges3->getStartEndAtChangeSelected()); $this->assertEquals(true, $proposedChanges3->isAnyChangesPossible()); $this->assertEquals(true, $proposedChanges3->getCustomFieldChangePossible($customFieldDefinition1)); $this->assertEquals(false, $proposedChanges3->getCustomFieldChangeSelected($customFieldDefinition1)); ## Now Set to don't update and run and test $proposedChanges1->setCustomFieldChangeSelected($customFieldDefinition1, false); $this->assertEquals(false, $proposedChanges1->applyToEvent($futureEvent1, $initialEventEdited)); $this->assertEquals("Dogs go miaow", $futureEvent1->getCustomField($customFieldDefinition1)); ## Now Set to do update and run and test $proposedChanges1->setCustomFieldChangeSelected($customFieldDefinition1, true); $this->assertEquals(true, $proposedChanges1->applyToEvent($futureEvent1, $initialEventEdited)); $this->assertEquals("Dogs go woof", $futureEvent1->getCustomField($customFieldDefinition1)); }
function testNotExists1() { $user = new UserAccountModel(); $user->setEmail("*****@*****.**"); $user->setUsername("test"); $user->setPassword("password"); $userRepo = new UserAccountRepository(); $userRepo->create($user); $site = new SiteModel(); $site->setTitle("Test"); $site->setSlug("test"); $siteRepo = new SiteRepository(); $siteRepo->create($site, $user, array(), $this->getSiteQuotaUsedForTesting()); $group = new GroupModel(); $group->setTitle("test"); $group->setDescription("test test"); $group->setUrl("http://www.group.com"); $groupRepo = new GroupRepository(); $groupRepo->create($group, $site, $user); $event1 = new EventModel(); $event1->setGroup($group); $event1->setStartAt($this->mktime(2013, 8, 1, 19, 0, 0)); $event1->setEndAt($this->mktime(2013, 8, 1, 21, 0, 0)); $eventRepository = new EventRepository(); $eventRepository->create($event1, $site, $user); $eventProposed = new EventModel(); $eventProposed->setGroup($group); $eventProposed->setStartAt($this->mktime(2013, 8, 2, 19, 0, 0)); $eventProposed->setEndAt($this->mktime(2013, 8, 2, 21, 0, 0)); $ersm = new EventRecurSetModel(); $events = $ersm->filterEventsForExisting($event1, array($eventProposed)); $this->assertEquals(1, count($events)); }
/** test event on 5TH tue in month. **/ function testFiveWeekInMonth2() { TimeSource::mock(2014, 4, 20, 14, 27, 0); $event = new EventModel(); $event->setStartAt($this->mktime(2014, 4, 29, 18, 30, 0)); $event->setEndAt($this->mktime(2014, 4, 29, 21, 0, 0)); $eventSet = new EventRecurSetModel(); $eventSet->setTimeZoneName('Europe/London'); $newEvents = $eventSet->getNewMonthlyEventsOnLastDayInWeek($event, 6 * 31); $this->assertTrue(count($newEvents) >= 3); $this->assertEquals($this->mktime(2014, 5, 27, 18, 30, 0)->format('r'), $newEvents[0]->getStartAt()->format('r')); $this->assertEquals($this->mktime(2014, 5, 27, 21, 0, 0)->format('r'), $newEvents[0]->getEndAt()->format('r')); $this->assertEquals($this->mktime(2014, 6, 24, 18, 30, 0)->format('r'), $newEvents[1]->getStartAt()->format('r')); $this->assertEquals($this->mktime(2014, 6, 24, 21, 0, 0)->format('r'), $newEvents[1]->getEndAt()->format('r')); $this->assertEquals($this->mktime(2014, 7, 29, 18, 30, 0)->format('r'), $newEvents[2]->getStartAt()->format('r')); $this->assertEquals($this->mktime(2014, 7, 29, 21, 0, 0)->format('r'), $newEvents[2]->getEndAt()->format('r')); }
function testChangeStartEnd1() { TimeSource::mock(2014, 1, 1, 9, 0, 0); $eventSet = new EventRecurSetModel(); $eventSet->setTimeZoneName('Europe/London'); $initialEvent = new EventModel(); $initialEvent->setSlug(1); $initialEvent->setSummary("Party"); $initialEvent->setStartAt(getUTCDateTime(2014, 1, 7, 19, 0, 0)); $initialEvent->setEndAt(getUTCDateTime(2014, 1, 7, 21, 0, 0)); $eventSet->setInitialEventJustBeforeLastChange($initialEvent); $initialEventEdited = clone $initialEvent; $initialEventEdited->setStartAt(getUTCDateTime(2014, 1, 7, 20, 0, 0)); $initialEventEdited->setEndAt(getUTCDateTime(2014, 1, 7, 23, 0, 0)); $eventSet->setInitalEvent($initialEventEdited); $futureEvent1 = new EventModel(); $futureEvent1->setSlug(2); $futureEvent1->setSummary("Party"); $futureEvent1->setStartAt(getUTCDateTime(2014, 1, 14, 19, 0, 0)); $futureEvent1->setEndAt(getUTCDateTime(2014, 1, 14, 21, 0, 0)); $eventSet->setFutureEvents(array($futureEvent1)); $eventHistory = new \models\EventHistoryModel(); $eventHistory->setFromDataBaseRow(array('event_id' => null, 'summary' => null, 'description' => null, 'start_at' => null, 'end_at' => null, 'created_at' => null, 'is_deleted' => null, 'is_cancelled' => null, 'country_id' => null, 'timezone' => null, 'venue_id' => null, 'url' => null, 'ticket_url' => null, 'is_virtual' => null, 'is_physical' => null, 'area_id' => null, 'user_account_id' => null, 'summary_changed' => '-1', 'description_changed' => '-1', 'start_at_changed' => '1', 'end_at_changed' => '1', 'is_deleted_changed' => '-1', 'country_id_changed' => '-1', 'timezone_changed' => '-1', 'venue_id_changed' => '-1', 'url_changed' => '-1', 'is_virtual_changed' => '-1', 'is_physical_changed' => '-1', 'area_id_changed' => '-1', 'is_new' => '-1', 'custom_fields' => null, 'custom_fields_changed' => null)); $eventSet->setInitalEventLastChange($eventHistory); ## Detect !!! $eventSet->applyChangeToFutureEvents(); ## Test Changes Picked Up $proposedChanges1 = $eventSet->getFutureEventsProposedChangesForEventSlug($futureEvent1->getSlug()); $this->assertEquals(false, $proposedChanges1->getSummaryChangePossible()); $this->assertEquals(false, $proposedChanges1->getSummaryChangeSelected()); $this->assertEquals(false, $proposedChanges1->getDescriptionChangePossible()); $this->assertEquals(false, $proposedChanges1->getDescriptionChangeSelected()); $this->assertEquals(false, $proposedChanges1->getTimezoneChangePossible()); $this->assertEquals(false, $proposedChanges1->getTimezoneChangeSelected()); $this->assertEquals(false, $proposedChanges1->getCountryAreaVenueIdChangePossible()); $this->assertEquals(false, $proposedChanges1->getCountryAreaVenueIdChangeSelected()); $this->assertEquals(false, $proposedChanges1->getUrlChangePossible()); $this->assertEquals(false, $proposedChanges1->getUrlChangeSelected()); $this->assertEquals(false, $proposedChanges1->getIsVirtualChangePossible()); $this->assertEquals(false, $proposedChanges1->getIsVirtualChangeSelected()); $this->assertEquals(false, $proposedChanges1->getIsPhysicalChangePossible()); $this->assertEquals(false, $proposedChanges1->getIsPhysicalChangeSelected()); $this->assertEquals(true, $proposedChanges1->getStartEndAtChangePossible()); $this->assertEquals(true, $proposedChanges1->getStartEndAtChangeSelected()); $this->assertEquals(true, $proposedChanges1->isAnyChangesPossible()); ## Now Set to don't update and run and test $proposedChanges1->setStartEndAtChangeSelected(false); $this->assertEquals(false, $proposedChanges1->applyToEvent($futureEvent1, $initialEventEdited)); $this->assertEquals(getUTCDateTime(2014, 1, 14, 19, 0, 0)->getTimestamp(), $futureEvent1->getStartAtInUTC()->getTimestamp()); $this->assertEquals(getUTCDateTime(2014, 1, 14, 21, 0, 0)->getTimestamp(), $futureEvent1->getEndAtInUTC()->getTimestamp()); ## Now Set to do update and run and test $proposedChanges1->setStartEndAtChangeSelected(true); $this->assertEquals(true, $proposedChanges1->applyToEvent($futureEvent1, $initialEventEdited)); $this->assertEquals(getUTCDateTime(2014, 1, 14, 20, 0, 0)->getTimestamp(), $futureEvent1->getStartAtInUTC()->getTimestamp()); $this->assertEquals(getUTCDateTime(2014, 1, 14, 23, 0, 0)->getTimestamp(), $futureEvent1->getEndAtInUTC()->getTimestamp()); }