_soapURL = $GLOBALS['sugar_config']['site_url'] . '/service/v4_1/soap.php'; parent::_setupTestUser(); parent::setUp(); $this->account = SugarTestAccountUtilities::createAccount(); $this->contact = SugarTestContactUtilities::createContact(); $this->account->load_relationship('contacts'); $this->account->contacts->add($this->contact->id); } public function tearDown() { SugarTestAccountUtilities::removeAllCreatedAccounts(); SugarTestContactUtilities::removeAllCreatedContacts(); parent::tearDown(); parent::_tearDownTestUser(); SugarTestHelper::tearDown(); } /** * Test checks that relationship between account & contact can be removed by soap * * @group 38858 * @return void */ public function testDeletionBySetRelationships() { $this->_login(); $result = $this->_soapClient->call('get_relationships', array( 'session' => $this->_sessionId, 'module_name' => 'Accounts', 'module_id' => $this->account->id, 'link_field_name' => 'contacts', 'related_module_query' => "", 'link_module_fields' => array('id'), 'deleted' => '1', )); $this->assertEquals(1, count($result['entry_list']), 'Response is incorrect'); $contact = reset($result['entry_list']); $this->assertEquals($this->contact->id, $contact['id'], 'Contact is incorrect'); $result = $this->_soapClient->call('set_relationship', array( 'session' => $this->_sessionId, 'module_name' => $this->account->module_dir, 'module_id' => $this->account->id, 'link_field_name' => 'contacts', 'related_ids' => array($this->contact->id), 'name_value_list' => array(), 'delete' => 1 )); $this->assertEquals(1, $result['deleted'], 'Contact is not deleted'); $result = $this->_soapClient->call('get_relationships', array( 'session' => $this->_sessionId, 'module_name' => 'Accounts', 'module_id' => $this->account->id, 'link_field_name' => 'contacts', 'related_module_query' => "", 'link_module_fields' => array('id'), 'deleted' => '1', )); $this->assertEquals(0, count($result['entry_list']), 'Contact is present'); } }