Add test, remove redundant api default
authorColeman Watts <coleman@civicrm.org>
Sun, 15 Jul 2018 15:08:53 +0000 (11:08 -0400)
committerColeman Watts <coleman@civicrm.org>
Sun, 15 Jul 2018 15:08:53 +0000 (11:08 -0400)
api/v3/Navigation.php
tests/phpunit/api/v3/NavigationTest.php

index 1ce843095c366798cffaaf39b404ae0f0bbe1c64..bce0ce008b62788df3e2f68df9bafc6b47597e58 100644 (file)
@@ -87,17 +87,6 @@ function civicrm_api3_navigation_get($params) {
   return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
 }
 
-/**
- * Adjust metadata for navigation create action.
- *
- * @param array $params
- */
-function _civicrm_api3_navigation_create_spec(&$params) {
-  $params['domain_id']['api.default'] = CRM_Core_Config::domainID();
-  $params['domain_id']['type'] = CRM_Utils_Type::T_INT;
-  $params['domain_id']['title'] = 'Domain ID';
-}
-
 /**
  * Create navigation item.
  *
index fe7f7a91c80dc3f24ed537d14bec6a3b205437c8..ae891aa6d633e417e218ac581cc101e3e1bbda32 100644 (file)
@@ -68,6 +68,17 @@ class api_v3_NavigationTest extends CiviUnitTestCase {
     $this->getAndCheck($params, $result['id'], $this->_entity, TRUE);
   }
 
+  /**
+   * Test create function.
+   */
+  public function testDefaultDomain() {
+    $params = array('label' => 'Herd the Cats');
+    $result = $this->callAPISuccess($this->_entity, 'create', $params);
+    // Check domain_id has been set per default
+    $params['domain_id'] = CRM_Core_Config::domainID();
+    $this->getAndCheck($params, $result['id'], $this->_entity, TRUE);
+  }
+
   /**
    * Test delete function.
    */