*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
require_once 'CiviTest/CiviUnitTestCase.php';
class CRM_Core_BAO_CustomValueTest extends CiviUnitTestCase {
public function testTypeCheckWithValidInput() {
- $values = array();
$values = array(
'Memo' => 'Test1',
'String' => 'Test',
}
public function testTypeCheckWithInvalidInput() {
- $values = array();
$values = array('check1' => 'chk');
foreach ($values as $type => $value) {
$valid = CRM_Core_BAO_CustomValue::typecheck($type, $value);
}
public function testTypeCheckWithWrongInput() {
- $values = array();
$values = array(
'String' => 1,
'Boolean' => 'US',
}
public function testTypeToFieldWithValidInput() {
- $values = array();
$values = array(
'String' => 'char_data',
'File' => 'char_data',
}
public function testTypeToFieldWithWrongInput() {
- $values = array();
$values = array(
'String' => 'memo_data',
'File' => 'date_data',
}
}
- public function testFixFieldValueOfTypeMemo() {
+ public function fixCustomFieldValue() {
$customGroup = Custom::createGroup(array(), 'Individual');
$fields = array(
$customField = Custom::createField(array(), $fields);
$custom = 'custom_' . $customField->id;
- $params = array();
$params = array(
'email' => 'abc@webaccess.co.in',
$custom => 'note',
);
- CRM_Core_BAO_CustomValue::fixFieldValueOfTypeMemo($params);
+ CRM_Core_BAO_CustomValue::fixCustomFieldValue($params);
$this->assertEquals($params[$custom], '%note%', 'Checking the returned value of type Memo.');
Custom::deleteField($customField);
Custom::deleteGroup($customGroup);
}
- public function testFixFieldValueOfTypeMemoWithEmptyParams() {
+ public function testFixCustomFieldValueWithEmptyParams() {
$params = array();
- $result = CRM_Core_BAO_CustomValue::fixFieldValueOfTypeMemo($params);
+ $result = CRM_Core_BAO_CustomValue::fixCustomFieldValue($params);
$this->assertEquals($result, NULL, 'Checking the returned value of type Memo.');
}