Merge pull request #14417 from civicrm/5.14
[civicrm-core.git] / tests / phpunit / CRM / Contact / SelectorTest.php
index 7723201522e85eb8fa3b26b50abfa1be0014be8d..aae974183e1082d13984d1a2111015059031d00e 100644 (file)
@@ -95,10 +95,17 @@ class CRM_Contact_SelectorTest extends CiviUnitTestCase {
         ]);
         $rows = $selector->getRows(CRM_Core_Action::VIEW, 0, 50, '');
         $this->assertEquals(1, count($rows));
+
+        CRM_Core_DAO::reenableFullGroupByMode();
+        $rows = $selector->getRows(CRM_Core_Action::VIEW, 0, 50, '');
+
         $sortChar = $selector->alphabetQuery()->fetchAll();
         // sort name is stored in '<last_name>, <first_name>' format, as per which the first character would be B of Bond
         $this->assertEquals('B', $sortChar[0]['sort_name']);
         $this->assertEquals($contactID, key($rows));
+
+        CRM_Core_DAO::reenableFullGroupByMode();
+        $selector->getQueryObject()->getCachedContacts([$contactID], FALSE);
       }
     }
   }
@@ -150,8 +157,8 @@ class CRM_Contact_SelectorTest extends CiviUnitTestCase {
     // build cache key and use to it to fetch prev-next cache record
     $cacheKey = 'civicrm search ' . $key;
     $contacts = CRM_Utils_SQL_Select::from('civicrm_prevnext_cache')
-      ->select(['entity_id1', 'cacheKey'])
-      ->where("cacheKey = @key")
+      ->select(['entity_id1', 'cachekey'])
+      ->where("cachekey = @key")
       ->param('key', $cacheKey)
       ->execute()
       ->fetchAll();
@@ -159,7 +166,7 @@ class CRM_Contact_SelectorTest extends CiviUnitTestCase {
     // check the prevNext record matches
     $expectedEntry = [
       'entity_id1' => $contactID,
-      'cacheKey' => $cacheKey,
+      'cachekey' => $cacheKey,
     ];
     $this->checkArrayEquals($contacts[0], $expectedEntry);
   }