_soapURL = $GLOBALS['sugar_config']['site_url'].'/soap.php'; parent::setUp(); $this->_login(); // Logging in just before the SOAP call as this will also commit any pending DB changes $this->contact = SugarTestContactUtilities::createContact(); $this->contact->contacts_users_id = $GLOBALS['current_user']->id; $this->contact->save(); $this->account = SugarTestAccountUtilities::createAccount(); $this->account->email1 = $this->contact->email1; $this->account->save(); $this->lead = SugarTestLeadUtilities::createLead(); $this->lead->email1 = $this->contact->email1; $this->lead->save(); $GLOBALS['db']->commit(); // Making sure these changes are committed to the database } public function testSearchByModuleWithSessionIdHack() { //Assert that the plugin fix to use a blank user_name and session id as password works $modules = array('Contacts', 'Accounts', 'Leads'); $result = $this->_soapClient->call('search_by_module', array('user_name' => '', 'password' => $this->_sessionId, 'search_string' => $this->contact->email1, 'modules' => $modules, 'offset' => 0, 'max_results' => 10)); $this->assertTrue(!empty($result) && count($result['entry_list']) == 3, 'Incorrect number of results returned. HTTP Response: '.$this->_soapClient->response); //Assert that the traditional method of using user_name and password also works $result = $this->_soapClient->call('search_by_module', array('user_name' => $GLOBALS['current_user']->user_name, 'password' => $GLOBALS['current_user']->user_hash, 'search_string' => $this->contact->email1, 'modules' => $modules, 'offset' => 0, 'max_results' => 10)); $this->assertTrue(!empty($result) && count($result['entry_list']) == 3, 'Incorrect number of results returned. HTTP Response: '.$this->_soapClient->response); } }