CRM-16036 - unit test: search event on custom field.
authorJohan Vervloet <johanv@johanv.org>
Mon, 2 Mar 2015 10:39:43 +0000 (11:39 +0100)
committereileenmcnaugton <eileen@fuzion.co.nz>
Wed, 12 Aug 2015 23:39:18 +0000 (11:39 +1200)
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

index 2627e9c1bb60775d159f8b80f0fde63ddb2aba5d..3239613887214c9dcfc581b48e9682afc2cd2153 100644 (file)
@@ -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.
    */