/** * try to add a note type * */ public function testSearchNotes() { Tinebase_Notes::getInstance()->addNote($this->_objects['note']); $filter = array(array('field' => 'query', 'operator' => 'contains', 'value' => 'phpunit')); $paging = array(); $notes = $this->_instance->searchNotes($filter, $paging); $this->assertGreaterThan(0, $notes['totalcount']); $this->assertEquals($this->_objects['note']->note, $notes['results'][0]['note']); // delete note Tinebase_Notes::getInstance()->deleteNotesOfRecord($this->_objects['record']['model'], $this->_objects['record']['backend'], $this->_objects['record']['id']); }
/** * try to add a note type */ public function testSearchNotes() { $contact = Addressbook_Controller_Contact::getInstance()->create(new Addressbook_Model_Contact(array('n_family' => 'Schulz'))); $note = $this->_objects['note']; $note->record_id = $contact->getId(); Tinebase_Notes::getInstance()->addNote($note); $filter = array(array('field' => 'query', 'operator' => 'contains', 'value' => 'phpunit'), array('field' => "record_model", 'operator' => "equals", 'value' => $this->_objects['record']['model']), array('field' => 'record_id', 'operator' => 'equals', 'value' => $contact->getId())); $paging = array(); $notes = $this->_instance->searchNotes($filter, $paging); $this->assertGreaterThan(0, $notes['totalcount']); $found = false; foreach ($notes['results'] as $note) { if ($this->_objects['note']->note === $note['note']) { $found = true; } } $this->assertTrue($found, 'note not found in notes: ' . print_r($notes['results'], true)); // delete note Tinebase_Notes::getInstance()->deleteNotesOfRecord($this->_objects['record']['model'], $this->_objects['record']['backend'], $contact->getId()); }
/** * check 'changed' system note and modlog after tag/customfield update * * @param string $_recordId * @param string|array $_expectedText * @param integer $_changedNoteNumber */ protected function _checkChangedNote($_recordId, $_expectedText = array(), $_changedNoteNumber = 3) { $tinebaseJson = new Tinebase_Frontend_Json(); $history = $tinebaseJson->searchNotes(array(array('field' => 'record_id', 'operator' => 'equals', 'value' => $_recordId), array('field' => "record_model", 'operator' => "equals", 'value' => 'Addressbook_Model_Contact')), array('sort' => array('note_type_id', 'creation_time'))); $this->assertEquals($_changedNoteNumber, $history['totalcount'], print_r($history, TRUE)); $changedNote = $history['results'][$_changedNoteNumber - 1]; foreach ((array) $_expectedText as $text) { $this->assertContains($text, $changedNote['note'], print_r($changedNote, TRUE)); } }
/** * testFreeBusyCleanupOfNotes * * @see 0009918: shared (only free/busy) calendar is showing event details within the history tab. */ public function testFreeBusyCleanupOfNotes() { $eventData = $this->testFreeBusyCleanup(); $tinebaseJson = new Tinebase_Frontend_Json(); $filter = array(array('field' => "record_model", 'operator' => "equals", 'value' => "Calendar_Model_Event"), array('field' => 'record_id', 'operator' => 'equals', 'value' => $eventData['id'])); $notes = $tinebaseJson->searchNotes($filter, array()); $this->assertEquals(0, $notes['totalcount'], 'should not find any notes of record'); $this->assertEquals(0, count($notes['results']), 'should not find any notes of record'); }