From: eileenmcnaugton Date: Mon, 8 Aug 2016 00:24:07 +0000 (+1200) Subject: Update test to reflect the groupNesting behaviour. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=4b31f9913536dcf5079436c7ba742123f6552853;p=civicrm-core.git Update test to reflect the groupNesting behaviour. The changes mean that a duplicate groupNesting entry will not be created. This is more correct so lets fix the test to reflect it --- diff --git a/tests/phpunit/api/v3/GroupNestingTest.php b/tests/phpunit/api/v3/GroupNestingTest.php index d20b5d5785..4f08568630 100644 --- a/tests/phpunit/api/v3/GroupNestingTest.php +++ b/tests/phpunit/api/v3/GroupNestingTest.php @@ -183,7 +183,7 @@ class api_v3_GroupNestingTest extends CiviUnitTestCase { 'parent_group_id' => 1, 'child_group_id' => 700, ); - $result = $this->callAPISuccess('group_nesting', 'get', $params); + $this->callAPISuccess('group_nesting', 'get', $params); } ///////////////// civicrm_group_nesting_create methods @@ -198,24 +198,10 @@ class api_v3_GroupNestingTest extends CiviUnitTestCase { 'child_group_id' => 3, ); - $result = $this->callAPIAndDocument('group_nesting', 'create', $params, __FUNCTION__, __FILE__); - - // we have 4 group nesting records in the example - // data, expecting next number to be the id for newly created - $id = 5; - $this->assertDBState('CRM_Contact_DAO_GroupNesting', $id, $params); - } - - /** - * Test civicrm_group_nesting_create with empty parameter array. - * Error expected. - */ - public function testCreateWithEmptyParams() { - $result = $this->callAPIFailure('group_nesting', 'create', array()); + $this->callAPIAndDocument('group_nesting', 'create', $params, __FUNCTION__, __FILE__); + $this->callAPISuccessGetCount('GroupNesting', $params, 1); } - ///////////////// civicrm_group_nesting_remove methods - /** * Test civicrm_group_nesting_remove. */ @@ -228,16 +214,17 @@ class api_v3_GroupNestingTest extends CiviUnitTestCase { $result = $this->callAPISuccess('group_nesting', 'get', $getparams); $params = array('id' => $result['id']); - $result = $this->callAPIAndDocument('group_nesting', 'delete', $params, __FUNCTION__, __FILE__); + $this->callAPIAndDocument('group_nesting', 'delete', $params, __FUNCTION__, __FILE__); $this->assertEquals(0, $this->callAPISuccess('group_nesting', 'getcount', $getparams)); } /** * Test civicrm_group_nesting_remove with empty parameter array. + * * Error expected. */ public function testDeleteWithEmptyParams() { - $result = $this->callAPIFailure('group_nesting', 'delete', array()); + $this->callAPIFailure('group_nesting', 'delete', array()); } }