Fix smart group cache clear test so group we're clearing is actually a smart group
authorMatthew Wire <mjw@mjwconsult.co.uk>
Fri, 17 Sep 2021 12:59:51 +0000 (13:59 +0100)
committerMatthew Wire <mjw@mjwconsult.co.uk>
Sat, 18 Sep 2021 09:09:08 +0000 (10:09 +0100)
tests/phpunit/api/v3/ContactTest.php

index 6eb0b086247ff0f5932463e130e0bac46ea36ee3..a8d226c3459e560a78f3a856a7919f31db734a09 100644 (file)
@@ -146,9 +146,11 @@ class api_v3_ContactTest extends CiviUnitTestCase {
    * @throws \CRM_Core_Exception
    */
   public function testCreateIndividualNoCacheClear(): void {
-
     $contact = $this->callAPISuccess('contact', 'create', $this->_params);
-    $groupID = $this->groupCreate();
+
+    $smartGroupParams = ['form_values' => ['contact_type' => ['IN' => ['Household']]]];
+    $savedSearch = CRM_Contact_BAO_SavedSearch::create($smartGroupParams);
+    $groupID = $this->groupCreate(['saved_search_id' => $savedSearch->id]);
 
     $this->putGroupContactCacheInClearableState($groupID, $contact);