From 2c4ec68f67ef8102a86668ada8bd0f0fbc2926b4 Mon Sep 17 00:00:00 2001 From: Johan Vervloet Date: Thu, 15 Jun 2017 22:17:11 +0200 Subject: [PATCH] Tried to write a test. But since I have no working dev environment for the moment, I cannot run it myself. I will push it, and see if it passes. (If someone can check whether the tests fails on master, that would be very nice.) --- 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 eb02eeb8b7..3d3987072d 100644 --- a/tests/phpunit/api/v3/EventTest.php +++ b/tests/phpunit/api/v3/EventTest.php @@ -409,6 +409,27 @@ class api_v3_EventTest extends CiviUnitTestCase { $this->customGroupDelete($ids['custom_group_id']); } + /** + * Check searching on custom fields with IS NULL. + * + * https://issues.civicrm.org/jira/browse/CRM-20740 + */ + public function testSearchCustomFieldIsNull() { + // create custom group with custom field on event + $ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, __FILE__); + + // Search for events having NULL as the value for this custom + // field. This should return all events created in setUp. + $check = $this->callAPISuccess($this->_entity, 'get', array( + 'custom_' . $ids['custom_field_id'] => ['IS NULL' => 1], + )); + + $this->assertGreaterThan(0, $check['count']); + + $this->customFieldDelete($ids['custom_field_id']); + $this->customGroupDelete($ids['custom_group_id']); + } + /** * Test searching on custom fields returning a contact reference. * -- 2.25.1