Example #1
0
 /**
  * test search tags
  */
 public function testSearchTags()
 {
     $sharedTag = $this->_createSharedTag();
     $filter = new Tinebase_Model_TagFilter(array('name' => 'tag::%'));
     $paging = new Tinebase_Model_Pagination();
     $tags = $this->_instance->searchTags($filter, $paging);
     $count = $this->_instance->getSearchTagsCount($filter);
     $this->assertTrue($count > 0, 'did not find created tag');
     $this->assertContains('tag::', $tags->getFirstRecord()->name);
 }
 /**
  * test if the application parameter is used properly
  */
 public function testSearchTagsForApplication()
 {
     $this->_createSharedTag();
     $filter = new Tinebase_Model_TagFilter(array());
     $ids = $this->_instance->searchTags($filter)->getId();
     $this->_instance->deleteTags($ids);
     $t1 = $this->_createSharedTag('tag1');
     $t2 = $this->_createSharedTag('tag2');
     // this tag should not occur, search is in the addressbook application
     $crmAppId = Tinebase_Application::getInstance()->getApplicationByName('Crm')->getId();
     $t3 = $this->_createSharedTag('tag3', array($crmAppId));
     $filter = new Tinebase_Model_TagFilter(array('application' => 'Addressbook'));
     $tags = $this->_instance->searchTags($filter);
     $this->assertEquals(2, $tags->count());
 }