Merge pull request #11712 from jitendrapurohit/CRM-21795
[civicrm-core.git] / tests / phpunit / api / v3 / GroupNestingTest.php
index d20b5d5785e0bed0ecee857fbb97cb899050d859..16ccb6d7c2fe3ae4d8a03e3bd2aa4f61125e77bc 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2016                                |
+ | Copyright CiviCRM LLC (c) 2004-2018                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -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());
   }
 
 }