From: Johan Vervloet Date: Mon, 2 Mar 2015 10:39:43 +0000 (+0100) Subject: CRM-16036 - unit test: search event on custom field. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=1b68d37ef3561849fa4164c14d696fe3dd1107e5;p=civicrm-core.git CRM-16036 - unit test: search event on custom field. This test fails. ---------------------------------------- * CRM-16036: API: searching events on custom fields does not work https://issues.civicrm.org/jira/browse/CRM-16036 --- diff --git a/tests/phpunit/api/v3/EventTest.php b/tests/phpunit/api/v3/EventTest.php index 2627e9c1bb..3239613887 100644 --- a/tests/phpunit/api/v3/EventTest.php +++ b/tests/phpunit/api/v3/EventTest.php @@ -365,6 +365,27 @@ class api_v3_EventTest extends CiviUnitTestCase { $this->callAPISuccess($this->_entity, 'Delete', array('id' => $result['id'])); } + /** + * Check searching on custom fields. + * + * https://issues.civicrm.org/jira/browse/CRM-16036 + */ + public function testSearchCustomField() { + // create custom group with custom field on event + $ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, __FILE__); + + // Search for events having CRM-16036 as the value for this custom + // field. This should not return anything. + $check = $this->callAPISuccess($this->_entity, 'get', array( + 'custom_' . $ids['custom_field_id'] => 'CRM-16036', + )); + + $this->assertEquals(0, $check['count']); + + $this->customFieldDelete($ids['custom_field_id']); + $this->customGroupDelete($ids['custom_group_id']); + } + /** * Test that an event with a price set can be created. */