X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fapi%2Fv3%2FCustomFieldTest.php;h=95076fc7a33826317a5e8d8882b9ee97ea228521;hb=d9f3e1040fce71ff81f317e54bfedfafe6f30a3a;hp=76a14abcb3aadd4ee2878b7394217d39e8f344e9;hpb=518669f7fc6076a1246f3628f243097338d73876;p=civicrm-core.git diff --git a/tests/phpunit/api/v3/CustomFieldTest.php b/tests/phpunit/api/v3/CustomFieldTest.php index 76a14abcb3..95076fc7a3 100644 --- a/tests/phpunit/api/v3/CustomFieldTest.php +++ b/tests/phpunit/api/v3/CustomFieldTest.php @@ -555,6 +555,20 @@ class api_v3_CustomFieldTest extends CiviUnitTestCase { $this->customGroupDelete($customGroup['id']); } + public function testCustomFieldCreateWithOptionGroupName() { + $customGroup = $this->customGroupCreate(array('extends' => 'Individual', 'title' => 'test_custom_group')); + $params = array( + 'custom_group_id' => $customGroup['id'], + 'name' => 'Activity type', + 'label' => 'Activity type', + 'data_type' => 'String', + 'html_type' => 'Select', + 'option_group_id' => 'activity_type', + ); + $result = $this->callAPISuccess('CustomField', 'create', $params); + } + + /** * @param $getFieldsResult * @@ -569,4 +583,48 @@ class api_v3_CustomFieldTest extends CiviUnitTestCase { return $r; } + public function testMakeSearchableContactReferenceFieldUnsearchable() { + $customGroup = $this->customGroupCreate(array( + 'name' => 'testCustomGroup', + 'title' => 'testCustomGroup', + 'extends' => 'Individual', + )); + $params = array( + 'name' => 'testCustomField', + 'label' => 'testCustomField', + 'custom_group_id' => 'testCustomGroup', + 'data_type' => 'ContactReference', + 'html_type' => 'Autocomplete-Select', + 'is_searchable' => '1', + ); + $result = $this->callAPISuccess('CustomField', 'create', $params); + $params = [ + 'id' => $result['id'], + 'is_searchable' => 0, + ]; + $result = $this->callAPISuccess('CustomField', 'create', $params); + } + + public function testDisableSearchableContactReferenceField() { + $customGroup = $this->customGroupCreate(array( + 'name' => 'testCustomGroup', + 'title' => 'testCustomGroup', + 'extends' => 'Individual', + )); + $params = array( + 'name' => 'testCustomField', + 'label' => 'testCustomField', + 'custom_group_id' => 'testCustomGroup', + 'data_type' => 'ContactReference', + 'html_type' => 'Autocomplete-Select', + 'is_searchable' => '1', + ); + $result = $this->callAPISuccess('CustomField', 'create', $params); + $params = [ + 'id' => $result['id'], + 'is_active' => 0, + ]; + $result = $this->callAPISuccess('CustomField', 'create', $params); + } + }