+--------------------------------------------------------------------+
| CiviCRM version 4.6 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
require_once 'CiviTest/CiviUnitTestCase.php';
}
/**
- * Check checkbox type custom fields are created correctly
+ * Check checkbox type custom fields are created correctly.
+ *
* We want to ensure they are saved with separators as appropriate
*/
public function testCreateCustomCheckboxGrant() {
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'];
$savedValue = CRM_Core_DAO::singleValueQuery("SELECT {$columnName} FROM $customTable WHERE entity_id = {$result['id']}");
$this->assertEquals($expectedValue, $savedValue);
- // & check it will do the separating
- $this->params[$customFieldLabel] = 'valley,goat';
- $result = $this->callAPISuccess($this->_entity, 'create', $this->params);
- $savedValue = CRM_Core_DAO::singleValueQuery("SELECT {$columnName} FROM $customTable WHERE entity_id = {$result['id']}");
- $this->assertEquals($expectedValue, $savedValue);
-
- //& here is the odd but previously supported (form-oriented) format
- //& an array for good measure
- $this->params[$customFieldLabel] = array('valley' => 1, 'goat' => 1);
- $result = $this->callAPISuccess($this->_entity, 'create', $this->params);
- $savedValue = CRM_Core_DAO::singleValueQuery("SELECT {$columnName} FROM $customTable WHERE entity_id = {$result['id']}");
- $this->assertEquals($expectedValue, $savedValue);
-
//& an array for good measure
$this->params[$customFieldLabel] = array('valley', 'goat');
$result = $this->callAPISuccess($this->_entity, 'create', $this->params);
$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';
$baoObj->deleteTestObjects($baoString);
$baoObj->free();
}
+
}