CRM-13889 - Autoformat
authorTim Otten <totten@civicrm.org>
Thu, 16 Jan 2014 00:01:39 +0000 (16:01 -0800)
committerTim Otten <totten@civicrm.org>
Thu, 16 Jan 2014 00:01:39 +0000 (16:01 -0800)
api/v3/Dashboard.php
api/v3/DashboardContact.php
tests/phpunit/api/v3/DashboardContactTest.php
tests/phpunit/api/v3/DashboardTest.php

index ae427790362077a141db29ecdd9e7afa871afa58..44545071adc5cc63bff1794e4251f1f638d9c1c7 100644 (file)
@@ -52,7 +52,10 @@ function civicrm_api3_dashboard_create($params) {
     civicrm_api3_verify_one_mandatory($params,
       NULL,
       array(
-        'name', 'label', 'url', 'fullscreen_url',
+        'name',
+        'label',
+        'url',
+        'fullscreen_url',
       )
     );
   }
@@ -84,8 +87,8 @@ function _civicrm_api3_dashboard_create_spec(&$params) {
  */
 function civicrm_api3_dashboard_get($params) {
   $bao = new CRM_Core_BAO_Dashboard();
-  _civicrm_api3_dao_set_filter($bao, $params, true, 'Dashboard');
-  $dashlets = _civicrm_api3_dao_to_array($bao, $params, true,'Dashboard');
+  _civicrm_api3_dao_set_filter($bao, $params, TRUE, 'Dashboard');
+  $dashlets = _civicrm_api3_dao_to_array($bao, $params, TRUE, 'Dashboard');
   return civicrm_api3_create_success($dashlets, $params, 'dashboard', 'get', $bao);
 }
 
index 280420f70243e28ea11aab3ede957ffa3b2134e8..fd8337a652fcc479962db7307dc44d75dd860912 100644 (file)
@@ -42,7 +42,7 @@
  * @param array $params
  *
  * @return array
- * 
+ *
  */
 function civicrm_api3_dashboard_contact_create($params) {
   civicrm_api3_verify_one_mandatory($params,
@@ -74,7 +74,7 @@ function civicrm_api3_dashboard_contact_get($params) {
     )
   );
   $bao = new CRM_Core_BAO_Dashboard();
-  $dashboardContact = CRM_Core_BAO_Dashboard::getContactDashlets(TRUE, CRM_Utils_Array::value('contact_id',$params));
+  $dashboardContact = CRM_Core_BAO_Dashboard::getContactDashlets(TRUE, CRM_Utils_Array::value('contact_id', $params));
   return civicrm_api3_create_success($dashboardContact, $params, 'dashboard_contact', 'get');
 }
 
@@ -94,5 +94,5 @@ function _civicrm_api3_dashboard_contact_check_params(&$params) {
   if (!in_array($dashboard_id, $allDashlets)) {
     return civicrm_api3_create_error('Invalid Dashboard ID');
   }
-  return null;
+  return NULL;
 }
\ No newline at end of file
index 012a98ec25b571bac43141576656f9bb2b150c95..f4a27a3c8c119dab79246003c3b4cd446f624ffe 100644 (file)
@@ -27,8 +27,8 @@ require_once 'CiviTest/CiviUnitTestCase.php';
 /**
  *  Test APIv3 civicrm_action_schedule functions
  *
- *  @package CiviCRM_APIv3
- *  @subpackage API_ActionSchedule
+ * @package CiviCRM_APIv3
+ * @subpackage API_ActionSchedule
  */
 
 class api_v3_DashboardContactTest extends CiviUnitTestCase {
@@ -38,6 +38,7 @@ class api_v3_DashboardContactTest extends CiviUnitTestCase {
   protected $_apiversion = 3;
 
   public $_eNoticeCompliant = TRUE;
+
   /**
    *  Test setup for every test
    *
@@ -62,7 +63,7 @@ class api_v3_DashboardContactTest extends CiviUnitTestCase {
     );
     $this->quickCleanup($tablesToTruncate, TRUE);
   }
-  
+
   function testDashboardContactCreate() {
     $dashParams = array(
       'version' => 3,
@@ -71,21 +72,23 @@ class api_v3_DashboardContactTest extends CiviUnitTestCase {
       'url' => 'civicrm/report/list&compid=99&reset=1&snippet=5',
       'fullscreen_url' => 'civicrm/report/list&compid=99&reset=1&snippet=5&context=dashletFullscreen',
     );
-       $dashresult = $this->callAPISuccess('dashboard', 'create', $dashParams);
-       $contact = $this->callAPISuccess('contact', 'create', array( 'first_name' => 'abc1',
-      'contact_type' => 'Individual',
-      'last_name' => 'xyz1',
-      'email' => 'abc@abc.com')
-     );
-       $oldCount = CRM_Core_DAO::singleValueQuery("select count(*) from civicrm_dashboard_contact where contact_id = {$contact['id']} AND is_active = 1 AND dashboard_id = {$dashresult['id']}");
+    $dashresult = $this->callAPISuccess('dashboard', 'create', $dashParams);
+    $contact = $this->callAPISuccess('contact', 'create', array(
+        'first_name' => 'abc1',
+        'contact_type' => 'Individual',
+        'last_name' => 'xyz1',
+        'email' => 'abc@abc.com'
+      )
+    );
+    $oldCount = CRM_Core_DAO::singleValueQuery("select count(*) from civicrm_dashboard_contact where contact_id = {$contact['id']} AND is_active = 1 AND dashboard_id = {$dashresult['id']}");
     $params = array(
       'version' => 3,
       'contact_id' => $contact['id'],
       'dashboard_id' => $dashresult['id'],
       'is_active' => 1,
     );
-       $dashboradContact = $this->callAPISuccess('dashboard_contact', 'create', $params);
-       $newCount = CRM_Core_DAO::singleValueQuery("select count(*) from civicrm_dashboard_contact where contact_id = {$contact['id']} AND is_active = 1 AND dashboard_id = {$dashresult['id']}");
-       $this->assertEquals($oldCount+1, $newCount);
+    $dashboradContact = $this->callAPISuccess('dashboard_contact', 'create', $params);
+    $newCount = CRM_Core_DAO::singleValueQuery("select count(*) from civicrm_dashboard_contact where contact_id = {$contact['id']} AND is_active = 1 AND dashboard_id = {$dashresult['id']}");
+    $this->assertEquals($oldCount + 1, $newCount);
   }
 }
\ No newline at end of file
index baba27c2b1c24044a8c94f2abc48b0186cb6205c..c85fe680c5ac6ab1eab19fda8d5092d8149232a9 100644 (file)
@@ -27,8 +27,8 @@ require_once 'CiviTest/CiviUnitTestCase.php';
 /**
  *  Test APIv3 civicrm_action_schedule functions
  *
- *  @package CiviCRM_APIv3
- *  @subpackage API_ActionSchedule
+ * @package CiviCRM_APIv3
+ * @subpackage API_ActionSchedule
  */
 
 class api_v3_DashboardTest extends CiviUnitTestCase {
@@ -38,14 +38,15 @@ class api_v3_DashboardTest extends CiviUnitTestCase {
   protected $_apiversion = 3;
 
   public $_eNoticeCompliant = TRUE;
+
   /**
    *  Test setup for every test
    *
    *  Connect to the database, truncate the tables that will be used
    *  and redirect stdin to a temporary file
-  */
+   */
   public function setUp() {
-   //  Connect to the database
+    //  Connect to the database
     parent::setUp();
   }
 
@@ -63,7 +64,7 @@ class api_v3_DashboardTest extends CiviUnitTestCase {
   }
 
   function testDashboardCreate() {
-       $oldCount = CRM_Core_DAO::singleValueQuery('select count(*) from civicrm_dashboard');
+    $oldCount = CRM_Core_DAO::singleValueQuery('select count(*) from civicrm_dashboard');
     $params = array(
       'version' => 3,
       'label' => 'New Dashlet element',
@@ -75,8 +76,8 @@ class api_v3_DashboardTest extends CiviUnitTestCase {
     $this->assertTrue(is_numeric($dashboard['id']), "In line " . __LINE__);
     $this->assertTrue($dashboard['id'] > 0, "In line " . __LINE__);
     $newCount = CRM_Core_DAO::singleValueQuery('select count(*) from civicrm_dashboard');
-    $this->assertEquals($oldCount+1, $newCount);
-    $this->DashboardDelete($dashboard['id'],$oldCount);
+    $this->assertEquals($oldCount + 1, $newCount);
+    $this->DashboardDelete($dashboard['id'], $oldCount);
   }
 
   function DashboardDelete($id, $oldCount) {