/** * testConcurrentAttendeeChangeUpdate * * @see 0008078: concurrent attendee change should be merged */ public function testConcurrentAttendeeChangeUpdate() { $eventData = $this->testCreateEvent(); $currentAttendee = $eventData['attendee']; $adminIndex = $eventData['attendee'][0]['user_id']['n_fn'] === 'Susan Clever' ? 1 : 0; $eventData['attendee'][$adminIndex]['status'] = Calendar_Model_Attender::STATUS_TENTATIVE; $event = $this->_uit->saveEvent($eventData); $loggedMods = Tinebase_Timemachine_ModificationLog::getInstance()->getModificationsBySeq(Tinebase_Application::getInstance()->getApplicationByName('Calendar')->getId(), new Calendar_Model_Attender($eventData['attendee'][$adminIndex]), 2); $this->assertEquals(1, count($loggedMods), 'attender modification has not been logged'); $eventData['attendee'] = $currentAttendee; $scleverIndex = $adminIndex === 1 ? 0 : 1; $attendeeBackend = new Calendar_Backend_Sql_Attendee(); $eventData['attendee'][$scleverIndex]['status_authkey'] = $attendeeBackend->get($eventData['attendee'][$scleverIndex]['id'])->status_authkey; $eventData['attendee'][$scleverIndex]['status'] = Calendar_Model_Attender::STATUS_TENTATIVE; $event = $this->_uit->saveEvent($eventData); foreach ($event['attendee'] as $attender) { $this->assertEquals(Calendar_Model_Attender::STATUS_TENTATIVE, $attender['status'], 'both attendee status should be TENTATIVE: ' . print_r($attender, TRUE)); } }
/** * testSetAttenderStatus */ public function testSetAttenderStatus() { $eventData = $this->testCreateEvent(); $numAttendee = count($eventData['attendee']); $eventData['attendee'][$numAttendee] = array('user_id' => $this->_personasContacts['pwulf']->getId()); $updatedEventData = $this->_uit->saveEvent($eventData); $pwulf = $this->_findAttender($updatedEventData['attendee'], 'pwulf'); // he he, we don't have his authkey, cause json class sorts it out due to rights restrictions. $attendeeBackend = new Calendar_Backend_Sql_Attendee(); $pwulf['status_authkey'] = $attendeeBackend->get($pwulf['id'])->status_authkey; $updatedEventData['container_id'] = $updatedEventData['container_id']['id']; $pwulf['status'] = Calendar_Model_Attender::STATUS_ACCEPTED; $this->_uit->setAttenderStatus($updatedEventData, $pwulf, $pwulf['status_authkey']); $loadedEventData = $this->_uit->getEvent($eventData['id']); $loadedPwulf = $this->_findAttender($loadedEventData['attendee'], 'pwulf'); $this->assertEquals(Calendar_Model_Attender::STATUS_ACCEPTED, $loadedPwulf['status']); }