コード例 #1
0
 /**
  * Test whether splitting an recurring event saves the new event under a new UID.
  * See http://jira.opensource.mayflower.de/jira/browse/PHPROJEKT-298 for the ratio behind this.
  */
 public function testSplittingRecurrenceGivesNewUidAndUri()
 {
     $this->setRequestUrl('Calendar2/index/jsonSave/nodeId/1/id/0');
     $this->request->setParam('comments', '');
     $this->request->setParam('confirmationStatus', '2');
     $this->request->setParam('description', '');
     $this->request->setParam('end', '2011-12-01 09:00');
     $this->request->setParam('location', '');
     $this->request->setParam('ownerId', '2');
     $this->request->setParam('participants', '2');
     $this->request->setParam('rrule', 'FREQ=DAILY;INTERVAL=1;BYDAY=');
     $this->request->setParam('sendNotification', '0');
     $this->request->setParam('start', '2011-12-01 08:00');
     $this->request->setParam('summary', 'test');
     $this->request->setParam('visibility', '1');
     $response = $this->getResponse();
     $this->assertContains(IndexController::ADD_TRUE_TEXT, $response);
     $response = Zend_Json::decode(substr($response, 5, -1));
     $this->assertArrayHasKey('id', $response);
     $firstId = $response['id'];
     $this->_reset();
     $tzOffset = (int) Phprojekt_Auth_Proxy::getEffectiveUser()->getSetting('timeZone', '0');
     $hour = 8 - $tzOffset;
     $hour = sprintf('%02d', $hour);
     $this->setRequestUrl("Calendar2/index/jsonSave/nodeId/1/id/{$firstId}/occurrence/2011-12-03%20{$hour}:00:00");
     $this->request->setParam('comments', '');
     $this->request->setParam('confirmationStatus', '2');
     $this->request->setParam('description', '');
     $this->request->setParam('end', '2011-12-03 09:00:00');
     $this->request->setParam('location', '');
     $this->request->setParam('multipleEvents', 'true');
     $this->request->setParam('occurrence', '2011-12-03 08:00:00');
     $this->request->setParam('ownerId', '2');
     $this->request->setParam('participants', '2');
     $this->request->setParam('rrule', 'FREQ=DAILY;INTERVAL=1;BYDAY=');
     $this->request->setParam('sendNotification', '0');
     $this->request->setParam('start', '2011-12-03 08:00:00');
     $this->request->setParam('summary', 'something else');
     $this->request->setParam('visibility', '1');
     $response = $this->getResponse();
     $this->assertContains(IndexController::EDIT_TRUE_TEXT, $response);
     $response = Zend_Json::decode(substr($response, 5, -1));
     $this->assertArrayHasKey('id', $response);
     $secondId = $response['id'];
     $first = new Calendar2_Models_Calendar2();
     $first->find($firstId);
     $second = new Calendar2_Models_Calendar2();
     $second->find($secondId);
     $this->assertNotEquals($first->uid, $second->uid);
     $this->assertNotEquals($first->uri, $second->uri);
 }