From 4e111ad2037759ddcde8e5c9e91eee8a1331fb89 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Thu, 20 May 2021 15:36:42 +1200 Subject: [PATCH] Superficial tidy up in test class --- tests/phpunit/api/v3/EntityBatchTest.php | 27 ++++++++++++++---------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/tests/phpunit/api/v3/EntityBatchTest.php b/tests/phpunit/api/v3/EntityBatchTest.php index da52303b6a..d15953c989 100644 --- a/tests/phpunit/api/v3/EntityBatchTest.php +++ b/tests/phpunit/api/v3/EntityBatchTest.php @@ -15,8 +15,6 @@ * @group headless */ class api_v3_EntityBatchTest extends CiviUnitTestCase { - - protected $_apiversion = 3; protected $params; protected $id; protected $_entity; @@ -34,34 +32,41 @@ class api_v3_EntityBatchTest extends CiviUnitTestCase { $entityParams = ['contact_id' => $this->individualCreate()]; $this->_entity = 'EntityBatch'; - $this->_entityID = $this->contributionCreate($entityParams); - $this->_batchID = $this->batchCreate(); $this->params = [ - 'entity_id' => $this->_entityID, - 'batch_id' => $this->_batchID, + 'entity_id' => $this->contributionCreate($entityParams), + 'batch_id' => $this->batchCreate(), 'entity_table' => 'civicrm_financial_trxn', ]; } - public function testCreateEntityBatch() { + /** + * @throws \CRM_Core_Exception + */ + public function testCreateEntityBatch(): void { $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); + /** + * @throws \CRM_Core_Exception + */ + public function testGetEntityBatch(): void { + $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', ['id' => $result['id']]); } - public function testDeleteEntityBatch() { + /** + * @throws \CRM_Core_Exception + */ + public function testDeleteEntityBatch(): void { $result = $this->callAPISuccess($this->_entity, 'create', $this->params); $deleteParams = ['id' => $result['id']]; - $result = $this->callAPIAndDocument($this->_entity, 'delete', $deleteParams, __FUNCTION__, __FILE__); + $this->callAPIAndDocument($this->_entity, 'delete', $deleteParams, __FUNCTION__, __FILE__); $checkDeleted = $this->callAPISuccess($this->_entity, 'get', []); $this->assertEquals(0, $checkDeleted['count']); } -- 2.25.1