Fix mailing test and allow for name or label to be used in navigation as that seems...
authorSeamus Lee <seamuslee001@gmail.com>
Wed, 3 Aug 2016 08:59:27 +0000 (18:59 +1000)
committerSeamus Lee <seamuslee001@gmail.com>
Thu, 4 Aug 2016 07:21:22 +0000 (17:21 +1000)
api/v3/Navigation.php
tests/phpunit/api/v3/MailingTest.php
tests/phpunit/api/v3/NavigationTest.php

index b7d0d058177d4b6426a1d8a8d09f716f57ff9020..e550cfa1f7c2351b77761e14e0de6ebdf5ecb8f7 100644 (file)
@@ -93,7 +93,9 @@ function civicrm_api3_navigation_get($params) {
  * @param array $params
  */
 function _civicrm_api3_navigation_create_spec(&$params) {
-  $params['name']['api.required'] = 1;
+  $params['domain_id']['api.default'] = CRM_Core_Config::domainID();
+  $params['domain_id']['type'] = CRM_Utils_Type::T_INT;
+  $params['domain_id']['title'] = 'Domain ID';
 }
 
 /**
@@ -106,6 +108,7 @@ function _civicrm_api3_navigation_create_spec(&$params) {
  *   API result array.
  */
 function civicrm_api3_navigation_create($params) {
+  civicrm_api3_verify_one_mandatory($params, NULL, array('name', 'label'));
   return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
 }
 
index 7f5f21c4e550033bf4e5d995c80a21ba10921a76..df802be370d022e79cebe41b6e9f5914eadbba13 100644 (file)
@@ -62,6 +62,8 @@ class api_v3_MailingTest extends CiviUnitTestCase {
     );
 
     $this->footer = civicrm_api3('MailingComponent', 'create', array(
+      'name' => 'test domain footer',
+      'component_type' => 'footer',
       'body_html' => '<p>From {domain.address}. To opt out, go to {action.optOutUrl}.</p>',
       'body_text' => 'From {domain.address}. To opt out, go to {action.optOutUrl}.',
     ));
index 1dea146e0a21fb23ee3657cb24a113c8378af875..85c69818b6d1434f129a2885e68848dd7d98e642 100644 (file)
@@ -46,7 +46,7 @@ class api_v3_NavigationTest extends CiviUnitTestCase {
    * Test create function.
    */
   public function testCreate() {
-    $params = array('name' => 'feed', 'label' => 'Feed the Goats', 'domain_id' => 1);
+    $params = array('label' => 'Feed the Goats', 'domain_id' => 1);
     $result = $this->callAPISuccess($this->_entity, 'create', $params);
     $this->getAndCheck($params, $result['id'], $this->_entity, TRUE);
   }