_apiversion = 3; $this->params = array( 'title' => "campaign title", 'description' => "Call people, ask for money", 'created_date' => 'first sat of July 2008', ); parent::setUp(); $this->useTransaction(TRUE); } public function testCreateCampaign() { $description = "Create a campaign - Note use of relative dates here: @link http://www.php.net/manual/en/datetime.formats.relative.php."; $result = $this->callAPIAndDocument('campaign', 'create', $this->params, __FUNCTION__, __FILE__, $description); $this->assertEquals(1, $result['count']); $this->assertNotNull($result['values'][$result['id']]['id']); $this->getAndCheck(array_merge($this->params, array('created_date' => '2008-07-05 00:00:00')), $result['id'], 'campaign', TRUE); } public function testGetCampaign() { $result = $this->callAPISuccess('campaign', 'create', $this->params); $result = $this->callAPIAndDocument('campaign', 'get', $this->params, __FUNCTION__, __FILE__); $this->assertEquals(1, $result['count']); $this->assertNotNull($result['values'][$result['id']]['id']); } public function testDeleteCampaign() { $this->callAPISuccess('campaign', 'create', $this->params); $entity = $this->callAPISuccess('campaign', 'get', ($this->params)); $delete = array('id' => $entity['id']); $result = $this->callAPIAndDocument('campaign', 'delete', $delete, __FUNCTION__, __FILE__); $checkDeleted = $this->callAPISuccess('campaign', 'get', array()); $this->assertEquals(0, $checkDeleted['count']); } }