2 require_once('include/nusoap/nusoap.php');
4 abstract class SOAPTestCase extends Sugar_PHPUnit_Framework_TestCase
7 public $_soapClient = null;
8 public $_session = null;
9 public $_sessionId = '';
10 public $_soapURL = '';
16 public function setUp()
20 require('include/modules.php');
21 $GLOBALS['beanList'] = $beanList;
22 $GLOBALS['beanFiles'] = $beanFiles;
24 $this->_soapClient = new nusoapclient($this->_soapURL,false,false,false,false,false,600,600);
25 $this->_setupTestUser();
30 * Remove anything that was used during this test
33 public function tearDown()
35 $this->_tearDownTestUser();
37 $this->_sessionId = '';
39 unset($GLOBALS['beanList']);
40 unset($GLOBALS['beanFiles']);
44 protected function _login()
46 $result = $this->_soapClient->call('login',
48 array('user_name' => $this->_user->user_name,
49 'password' => $this->_user->user_hash,
51 'application_name' => 'SoapTest')
53 $this->_sessionId = $result['id'];
61 public function _setupTestUser() {
62 $this->_user = SugarTestUserUtilities::createAnonymousUser();
63 $this->_user->status = 'Active';
64 $this->_user->is_admin = 1;
66 $GLOBALS['current_user'] = $this->_user;
70 * Remove user created for test
73 public function _tearDownTestUser() {
74 SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
75 unset($GLOBALS['current_user']);