From 1b68d37ef3561849fa4164c14d696fe3dd1107e5 Mon Sep 17 00:00:00 2001 From: Johan Vervloet Date: Mon, 2 Mar 2015 11:39:43 +0100 Subject: [PATCH] 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 --- tests/phpunit/api/v3/EventTest.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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. */ -- 2.25.1