params = array( 'domain_id' => 1, 'name' => "my mail setting", 'domain' => 'setting.com', 'local_part' => 'civicrm+', 'server' => "localhost", 'username' => 'sue', 'password' => 'pass', ); parent::setUp(); } function tearDown() {} public function testCreateMailSettings() { $result = $this->callAPIAndDocument('MailSettings', 'create', $this->params, __FUNCTION__, __FILE__); $this->assertEquals(1, $result['count'], 'In line ' . __LINE__); $this->assertNotNull($result['values'][$result['id']]['id'], 'In line ' . __LINE__); } public function testGetMailSettings() { $result = $this->callAPIAndDocument('MailSettings', 'get', $this->params, __FUNCTION__, __FILE__); $this->assertEquals(1, $result['count'], 'In line ' . __LINE__); $this->assertNotNull($result['values'][$result['id']]['id'], 'In line ' . __LINE__); } public function testDeleteMailSettings() { $entity = $this->callAPISuccess('MailSettings', 'get', $this->params); $this->assertEquals('setting.com', $entity['values'][$entity['id']]['domain'], 'In line ' . __LINE__); $result = $this->callAPIAndDocument('MailSettings', 'delete', array('id' => $entity['id']), __FUNCTION__, __FILE__); $checkDeleted = $this->callAPISuccess('MailSettings', 'get', array()); $this->assertEquals('EXAMPLE.ORG', $checkDeleted['values'][$checkDeleted['id']]['domain'], 'In line ' . __LINE__); } public function testGetMailSettingsChainDelete() { $description = "demonstrates get + delete in the same call"; $subfile = 'ChainedGetDelete'; $params = array( 'title' => "MailSettings title", 'api.MailSettings.delete' => 1, ); $result = $this->callAPISuccess('MailSettings', 'create', $this->params); $result = $this->callAPIAndDocument('MailSettings', 'get', $params, __FUNCTION__, __FILE__, $description, $subfile); $this->assertEquals(0, $this->callAPISuccess('MailSettings', 'getcount', array()), 'In line ' . __LINE__); } }