From: Tim Otten Date: Fri, 9 Aug 2013 22:36:19 +0000 (-0700) Subject: CRM-13089 - Add unit test for a creating field with a specific "name" X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=43ff319625fb5cf748032f3cf4131a559cd18475;p=civicrm-core.git CRM-13089 - Add unit test for a creating field with a specific "name" ---------------------------------------- * CRM-13089: CRM_Core_BAO_CustomField::create overrides user-defined name parameter values http://issues.civicrm.org/jira/browse/CRM-13089 --- diff --git a/tests/phpunit/CRM/Core/BAO/CustomFieldTest.php b/tests/phpunit/CRM/Core/BAO/CustomFieldTest.php index 6d85f26f92..4314532808 100644 --- a/tests/phpunit/CRM/Core/BAO/CustomFieldTest.php +++ b/tests/phpunit/CRM/Core/BAO/CustomFieldTest.php @@ -72,6 +72,27 @@ class CRM_Core_BAO_CustomFieldTest extends CiviUnitTestCase { Custom::deleteGroup($customGroup); } + function testCreateCustomfieldName() { + $customGroup = Custom::createGroup(array(), 'Individual'); + $fields = array( + 'label' => 'testFld 2', + 'name' => 'special_fldlname', + 'data_type' => 'String', + 'html_type' => 'Text', + 'custom_group_id' => $customGroup->id, + ); + $customField = CRM_Core_BAO_CustomField::create($fields); + $customFieldID = $this->assertDBNotNull('CRM_Core_DAO_CustomField', $customGroup->id, 'id', 'custom_group_id', + 'Database check for created CustomField.' + ); + $dbFieldName = $this->assertDBNotNull('CRM_Core_DAO_CustomField', $customFieldID, 'name', 'id', 'Database check for edited CustomField.'); + $this->assertEquals($fields['name'], $dbFieldName, + "Column name set as specified"); + + Custom::deleteGroup($customGroup); + } + + function testGetFields() { $customGroup = Custom::createGroup(array(), 'Individual'); $fields = array(