useTransaction(TRUE); $entityParams = array('contact_id' => 1); $this->_entity = 'EntityBatch'; $this->_entityID = $this->contributionCreate($entityParams); $this->_batchID = $this->batchCreate(); $this->params = array( 'entity_id' => $this->_entityID, 'batch_id' => $this->_batchID, 'entity_table' => 'civicrm_financial_trxn', ); } public function testCreateEntityBatch() { $result = $this->callAPIAndDocument($this->_entity, 'create', $this->params, __FUNCTION__, __FILE__); $this->assertEquals(1, $result['count']); $this->getAndCheck($this->params, $result['id'], $this->_entity); $this->assertNotNull($result['values'][$result['id']]['id']); } public function testGetEntityBatch() { $result = $this->callAPISuccess($this->_entity, 'create', $this->params); $result = $this->callAPIAndDocument($this->_entity, 'get', $this->params, __FUNCTION__, __FILE__); $this->assertEquals(1, $result['count']); $this->assertNotNull($result['values'][$result['id']]['id']); $this->callAPISuccess($this->_entity, 'delete', array('id' => $result['id'])); } public function testDeleteEntityBatch() { $result = $this->callAPISuccess($this->_entity, 'create', $this->params); $deleteParams = array('id' => $result['id']); $result = $this->callAPIAndDocument($this->_entity, 'delete', $deleteParams, __FUNCTION__, __FILE__); $checkDeleted = $this->callAPISuccess($this->_entity, 'get', array()); $this->assertEquals(0, $checkDeleted['count']); } }