/**
  * testAdvancedSearch in related products
  * 
  * @see 0010814: quicksearch should search in related records
  */
 public function testAdvancedSearchInProduct()
 {
     Tinebase_Core::getPreference()->setValue(Tinebase_Preference::ADVANCED_SEARCH, true);
     $this->_saveLead();
     $filter = array(array('field' => 'query', 'operator' => 'contains', 'value' => 'PHPUnit test product'));
     $searchLeads = $this->_instance->searchLeads($filter, '');
     $this->assertEquals(1, $searchLeads['totalcount']);
 }
예제 #2
0
 /**
  * test tag filter (adds a contact with the same id + tag)
  * 
  * see bug #4834 (http://forge.tine20.org/mantisbt/view.php?id=4834)
  */
 public function testTagFilter()
 {
     $lead = $this->_getLead();
     $savedLead = $this->_instance->saveLead($lead->toArray());
     $sharedTagName = Tinebase_Record_Abstract::generateUID();
     $tag = new Tinebase_Model_Tag(array('type' => Tinebase_Model_Tag::TYPE_SHARED, 'name' => $sharedTagName, 'description' => 'testTagFilter', 'color' => '#009B31'));
     $contact = $this->_getContact();
     $contact->setId($savedLead['id']);
     $contact->tags = array($tag);
     $savedContact = Addressbook_Controller_Contact::getInstance()->create($contact);
     $tag = $savedContact->tags->getFirstRecord();
     $filter = array(array('field' => 'tag', 'operator' => 'equals', 'value' => $tag->getId()));
     $result = $this->_instance->searchLeads($filter, array());
     $this->assertEquals(0, $result['totalcount'], 'Should not find the lead!');
 }