/** * testUpdateRecurSeries */ public function testUpdateRecurSeries() { $recurSet = array_value('results', $this->testSearchRecuringIncludes()); $persistentException = $recurSet[1]; $persistentException['summary'] = 'go sleeping'; $persistentException['dtstart'] = '2009-04-01 20:00:00'; $persistentException['dtend'] = '2009-04-01 20:30:00'; // create persistent exception $this->_uit->createRecurException($persistentException, FALSE, FALSE); // update recurseries $someRecurInstance = $recurSet[2]; $someRecurInstance['summary'] = 'go fishing'; $someRecurInstance['dtstart'] = '2009-04-08 10:00:00'; $someRecurInstance['dtend'] = '2009-04-08 12:30:00'; $this->_uit->updateRecurSeries($someRecurInstance, FALSE, FALSE); $from = $recurSet[0]['dtstart']; $until = new Tinebase_DateTime($from); $until->addWeek(5)->addHour(10); $until = $until->get(Tinebase_Record_Abstract::ISO8601LONG); $filter = array(array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()), array('field' => 'period', 'operator' => 'within', 'value' => array('from' => $from, 'until' => $until))); $searchResultData = $this->_uit->searchEvents($filter, array()); $this->assertEquals(6, count($searchResultData['results'])); $summaryMap = array(); foreach ($searchResultData['results'] as $event) { $summaryMap[$event['dtstart']] = $event['summary']; } $this->assertTrue(array_key_exists('2009-04-01 20:00:00', $summaryMap)); $this->assertEquals('go sleeping', $summaryMap['2009-04-01 20:00:00']); $fishings = array_keys($summaryMap, 'go fishing'); $this->assertEquals(5, count($fishings)); foreach ($fishings as $dtstart) { $this->assertEquals('10:00:00', substr($dtstart, -8)); } }
/** * testAddAttachmentToRecurSeries * * @see 0005024: allow to attach external files to records */ public function testAddAttachmentToRecurSeries() { $tempFile = $this->_getTempFile(); $recurSet = Tinebase_Helper::array_value('results', $this->testSearchRecuringIncludes()); // update recurseries $someRecurInstance = $recurSet[2]; $someRecurInstance['attachments'] = array(array('tempFile' => array('id' => $tempFile->getId()))); $someRecurInstance['seq'] = 2; $this->_uit->updateRecurSeries($someRecurInstance, FALSE, FALSE); $searchResultData = $this->_searchRecurSeries($recurSet[0]); foreach ($searchResultData['results'] as $recurInstance) { $this->assertTrue(isset($recurInstance['attachments']), 'no attachments found in event: ' . print_r($recurInstance, TRUE)); $this->assertEquals(1, count($recurInstance['attachments'])); $attachment = $recurInstance['attachments'][0]; $this->assertEquals('text/plain', $attachment['contenttype'], print_r($attachment, TRUE)); } }