From 2f0c1d42f1be11f9b044f81f843bd06d96fc8960 Mon Sep 17 00:00:00 2001 From: monishdeb Date: Wed, 30 Sep 2015 11:19:41 +0530 Subject: [PATCH] test failure fix --- CRM/Contact/BAO/Query.php | 4 +++- tests/phpunit/CRM/Contact/BAO/QueryTest.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index 58d31d797f..002d42873f 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -1584,7 +1584,9 @@ class CRM_Contact_BAO_Query { // prior to 4.7, formValues for some attributes (e.g. group, tag) are stored in array(id1 => 1, id2 => 1), // as per the recent Search fixes $values need to be in standard array(id1, id2) format $ids = array_keys($values, 1); - if (count($ids) > 1 || (count($ids) == 1 && key($values) > 1)) { + if (count($ids) > 1 || + (count($ids) == 1 && (key($values) > 1 || (key($values) == 1 && $values[1] == 1))) // handle (0 => 4), (1 => 1) + ) { $values = $ids; } } diff --git a/tests/phpunit/CRM/Contact/BAO/QueryTest.php b/tests/phpunit/CRM/Contact/BAO/QueryTest.php index 5aeb61c656..1ff3bc78a7 100644 --- a/tests/phpunit/CRM/Contact/BAO/QueryTest.php +++ b/tests/phpunit/CRM/Contact/BAO/QueryTest.php @@ -199,7 +199,7 @@ class CRM_Contact_BAO_QueryTest extends CiviUnitTestCase { */ public function testGroupContactCacheAddSearch() { $returnProperties = array('contact_id'); - $params = array(array('group', 'IN', array(1 => 1), 0, 0)); + $params = array(array('group', 'IN', array(1), 0, 0)); $query = new CRM_Contact_BAO_Query( $params, $returnProperties, -- 2.25.1