From: Coleman Watts <coleman@civicrm.org>
Date: Thu, 7 Jan 2016 20:59:16 +0000 (-0500)
Subject: CRM-17795 - Api test fixes
X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=479bfd0fd7a8ac1ce11acd1328c040a508e8171c;p=civicrm-core.git

CRM-17795 - Api test fixes
---

diff --git a/Civi/API/SelectQuery.php b/Civi/API/SelectQuery.php
index fa5dec4351..d9879eeccb 100644
--- a/Civi/API/SelectQuery.php
+++ b/Civi/API/SelectQuery.php
@@ -189,7 +189,13 @@ class SelectQuery {
           }
         }
       }
-
+      // Ignore the "options" param if it is referring to api options and not a field in this entity
+      if (
+        $key === 'options' && is_array($value)
+        && !in_array(\CRM_Utils_Array::first(array_keys($value)), \CRM_Core_DAO::acceptedSQLOperators())
+      ) {
+        continue;
+      }
       $field = $this->getField($key);
       if ($field) {
         $key = $field['name'];
diff --git a/tests/phpunit/api/v3/MembershipTest.php b/tests/phpunit/api/v3/MembershipTest.php
index 323750176b..3f5176c083 100644
--- a/tests/phpunit/api/v3/MembershipTest.php
+++ b/tests/phpunit/api/v3/MembershipTest.php
@@ -609,7 +609,7 @@ class api_v3_MembershipTest extends CiviUnitTestCase {
     $this->contactMembershipCreate($this->_params);
     $result = $this->callAPISuccess('membership', 'get', array('return' => 'end_date'));
     foreach ($result['values'] as $membership) {
-      $this->assertEquals(array('end_date', 'membership_end_date', 'id'), array_keys($membership));
+      $this->assertEquals(array('end_date', 'id'), array_keys($membership));
     }
   }
   ///////////////// civicrm_membership_create methods