Coding standards cleanup sprint.
[civicrm-core.git] / tests / phpunit / api / v3 / GrantTest.php
index 339b1852634de6e811786246bb96221480fda266..de1e20dee86ba1363fbcfeb279b062e7d0d76813 100644 (file)
@@ -31,10 +31,9 @@ require_once 'CiviTest/CiviUnitTestCase.php';
 /**
  *  Test APIv3 civicrm_grant* functions
  *
- *  @package CiviCRM_APIv3
- *  @subpackage API_Grant
+ * @package CiviCRM_APIv3
+ * @subpackage API_Grant
  */
-
 class api_v3_GrantTest extends CiviUnitTestCase {
   protected $_apiversion = 3;
   protected $params;
@@ -47,7 +46,7 @@ class api_v3_GrantTest extends CiviUnitTestCase {
     parent::setUp();
     $this->ids['contact'][0] = $this->individualCreate();
     $this->params = array(
-           'contact_id' => $this->ids['contact'][0],
+      'contact_id' => $this->ids['contact'][0],
       'application_received_date' => 'now',
       'decision_date' => 'next Monday',
       'amount_total' => '500',
@@ -61,7 +60,7 @@ class api_v3_GrantTest extends CiviUnitTestCase {
   public function tearDown() {
     foreach ($this->ids as $entity => $entities) {
       foreach ($entities as $id) {
-        $this->callAPISuccess($entity, 'delete', array( 'id' => $id));
+        $this->callAPISuccess($entity, 'delete', array('id' => $id));
       }
     }
     $this->quickCleanup(array('civicrm_grant'));
@@ -91,9 +90,10 @@ class api_v3_GrantTest extends CiviUnitTestCase {
         array('label' => 'my goat', 'value' => 'goat', 'is_active' => TRUE, 'weight' => 2),
         array('label' => 'mohair', 'value' => 'wool', 'is_active' => TRUE, 'weight' => 3),
         array('label' => 'hungry', 'value' => '', 'is_active' => TRUE, 'weight' => 3),
-    )));
+      )
+    ));
     $columnName = $result['values'][$result['id']]['column_name'];
-    $ids['custom_field_id']  = $result['id'];
+    $ids['custom_field_id'] = $result['id'];
     $customFieldLabel = 'custom_' . $ids['custom_field_id'];
     $expectedValue = CRM_Core_DAO::VALUE_SEPARATOR . 'valley' . CRM_Core_DAO::VALUE_SEPARATOR;
     //first we pass in the core separators ourselves
@@ -112,7 +112,7 @@ class api_v3_GrantTest extends CiviUnitTestCase {
     $this->assertEquals($expectedValue, $savedValue);
 
     //let's try with 2 params already separated
-    $expectedValue = CRM_Core_DAO::VALUE_SEPARATOR . 'valley' . CRM_Core_DAO::VALUE_SEPARATOR . 'goat' .  CRM_Core_DAO::VALUE_SEPARATOR;
+    $expectedValue = CRM_Core_DAO::VALUE_SEPARATOR . 'valley' . CRM_Core_DAO::VALUE_SEPARATOR . 'goat' . CRM_Core_DAO::VALUE_SEPARATOR;
     $this->params[$customFieldLabel] = $expectedValue;
     $result = $this->callAPISuccess($this->_entity, 'create', $this->params);
     $savedValue = CRM_Core_DAO::singleValueQuery("SELECT {$columnName} FROM $customTable WHERE entity_id = {$result['id']}");
@@ -153,23 +153,23 @@ class api_v3_GrantTest extends CiviUnitTestCase {
     $result = $this->callAPISuccess($this->_entity, 'create', $this->params);
     $result = $this->callAPIAndDocument($this->_entity, 'delete', array('id' => $result['id']), __FUNCTION__, __FILE__);
     $this->assertAPISuccess($result, 'In line ' . __LINE__);
-    $checkDeleted = $this->callAPISuccess($this->_entity, 'get', array(
-           ));
+    $checkDeleted = $this->callAPISuccess($this->_entity, 'get', array());
     $this->assertEquals(0, $checkDeleted['count'], 'In line ' . __LINE__);
   }
+
   /*
- * This is a test to check if setting fields one at a time alters other fields
- * Issues Hit so far =
- * 1) Currency keeps getting reset to USD -  BUT this may be the only enabled currency
- *  - in which case it is valid
- * 2)
- */
 * This is a test to check if setting fields one at a time alters other fields
 * Issues Hit so far =
 * 1) Currency keeps getting reset to USD -  BUT this may be the only enabled currency
 *  - in which case it is valid
 * 2)
 */
 
   public function testCreateAutoGrant() {
     $entityName = $this->_entity;
-    $baoString  = 'CRM_Grant_BAO_Grant';
-    $fields     = $this->callAPISuccess($entityName, 'getfields', array(
-               'action' => 'create',
+    $baoString = 'CRM_Grant_BAO_Grant';
+    $fields = $this->callAPISuccess($entityName, 'getfields', array(
+        'action' => 'create',
       )
     );
 
@@ -178,9 +178,9 @@ class api_v3_GrantTest extends CiviUnitTestCase {
     $baoObj = new CRM_Core_DAO();
     $baoObj->createTestObject($baoString, array('currency' => 'USD'), 2, 0);
     $getentities = $this->callAPISuccess($entityName, 'get', array(
-               'sequential' => 1,
-        'return' => $return,
-      ));
+      'sequential' => 1,
+      'return' => $return,
+    ));
 
     // lets use first rather than assume only one exists
     $entity = $getentities['values'][0];
@@ -226,8 +226,8 @@ class api_v3_GrantTest extends CiviUnitTestCase {
           $entity[$field] = 'warm.beer.com';
       }
       $updateParams = array(
-               'id' => $entity['id'],
-         $field => $entity[$field],
+        'id' => $entity['id'],
+        $field => $entity[$field],
         'debug' => 1,
       );
       $update = $this->callAPISuccess($entityName, 'create', $updateParams);