2 require_once 'modules/Home/UnifiedSearchAdvanced.php';
3 require_once 'modules/Contacts/Contact.php';
4 require_once 'include/utils/layout_utils.php';
9 class UnifiedSearchAdvancedTest extends Sugar_PHPUnit_Framework_TestCase
11 protected $_contact = null;
13 public function setUp()
15 $GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser();
18 $contact = new Contact();
19 $contact->id = 'l_'.$unid;
20 $contact->first_name = 'Greg';
21 $contact->last_name = 'Brady';
22 $contact->new_with_id = true;
24 $this->_contact = $contact;
27 public function tearDown()
29 $GLOBALS['db']->query("DELETE FROM contacts WHERE id= '{$this->_contact->id}'");
30 unset($this->_contact);
33 public function testSearchByFirstName()
35 global $mod_strings, $modListHeader, $app_strings, $beanList, $beanFiles;
36 require('config.php');
37 require('include/modules.php');
38 $modListHeader = $moduleList;
39 $_REQUEST['query_string'] = $this->_contact->first_name;
40 $_REQUEST['module'] = 'Home';
41 $usa = new UnifiedSearchAdvanced();
44 $html = ob_get_contents();
46 $pos = strpos($html, $this->_contact->first_name);
47 $this->assertTrue(!empty($pos), "Could not find the contact: ".$this->_contact->first_name." in the search results.");
50 public function testSearchByFirstAndLastName()
52 global $mod_strings, $modListHeader, $app_strings, $beanList, $beanFiles;
53 require('config.php');
54 require('include/modules.php');
55 $_REQUEST['query_string'] = $this->_contact->first_name.' '.$this->_contact->last_name;
56 $_REQUEST['module'] = 'Home';
57 $usa = new UnifiedSearchAdvanced();
60 $html = ob_get_contents();
62 $pos = strpos($html, $this->_contact->first_name);
63 $this->assertTrue(!empty($pos), "Could not find the lead: ".$this->_contact->first_name." in the search results.");