From 0446b86b69262921dce6fd84e867ce9bc4fcc1fa Mon Sep 17 00:00:00 2001 From: larssandergreen Date: Mon, 24 Jul 2023 12:22:30 -0600 Subject: [PATCH] Update tests to ignore packaged saved searches --- .../tests/phpunit/Civi/Searches/SampleTest.php | 2 +- tests/phpunit/CRM/Mailing/Form/Task/AdhocMailingTest.php | 2 +- tests/phpunit/api/v4/Action/CurrentFilterTest.php | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ext/legacycustomsearches/tests/phpunit/Civi/Searches/SampleTest.php b/ext/legacycustomsearches/tests/phpunit/Civi/Searches/SampleTest.php index 737723c1cc..a8e065a178 100644 --- a/ext/legacycustomsearches/tests/phpunit/Civi/Searches/SampleTest.php +++ b/ext/legacycustomsearches/tests/phpunit/Civi/Searches/SampleTest.php @@ -237,7 +237,7 @@ class SampleTest extends TestCase implements HeadlessInterface, HookInterface, T 'Household - CA - 2', ]), ]; - $searches = SavedSearch::get()->addSelect('*')->execute(); + $searches = SavedSearch::get()->addSelect('*')->addWhere('has_base', '=', FALSE)->execute(); foreach ($searches as $index => $search) { $formValues = CRM_Contact_BAO_SavedSearch::getFormValues($search['id']); $obj = new CRM_Contact_Form_Search_Custom_Sample($formValues); diff --git a/tests/phpunit/CRM/Mailing/Form/Task/AdhocMailingTest.php b/tests/phpunit/CRM/Mailing/Form/Task/AdhocMailingTest.php index c92eb940b7..5277f5a69e 100644 --- a/tests/phpunit/CRM/Mailing/Form/Task/AdhocMailingTest.php +++ b/tests/phpunit/CRM/Mailing/Form/Task/AdhocMailingTest.php @@ -44,7 +44,7 @@ class CRM_Mailing_Form_Task_AdhocMailingTest extends CiviUnitTestCase { catch (CRM_Core_Exception_PrematureExitException $e) { // Nothing to see here. } - $savedSearch = $this->callAPISuccessGetSingle('SavedSearch', []); + $savedSearch = $this->callAPISuccessGetSingle('SavedSearch', ['where' => [['has_base', '=', FALSE]]]); $this->assertEquals($formValues, $savedSearch['form_values']); } diff --git a/tests/phpunit/api/v4/Action/CurrentFilterTest.php b/tests/phpunit/api/v4/Action/CurrentFilterTest.php index 43093ef3e4..1aba88b3ec 100644 --- a/tests/phpunit/api/v4/Action/CurrentFilterTest.php +++ b/tests/phpunit/api/v4/Action/CurrentFilterTest.php @@ -150,9 +150,9 @@ class CurrentFilterTest extends Api4TestBase implements TransactionalInterface { 'name' => 'expired', ])->execute()->first(); - $getCurrent = (array) SavedSearch::get()->addWhere('is_current', '=', TRUE)->execute()->indexBy('id'); - $notCurrent = (array) SavedSearch::get()->addWhere('is_current', '=', FALSE)->execute()->indexBy('id'); - $getAll = (array) SavedSearch::get()->addSelect('is_current')->execute()->indexBy('id'); + $getCurrent = (array) SavedSearch::get()->addWhere('is_current', '=', TRUE)->addWhere('has_base', '=', FALSE)->execute()->indexBy('id'); + $notCurrent = (array) SavedSearch::get()->addWhere('is_current', '=', FALSE)->addWhere('has_base', '=', FALSE)->execute()->indexBy('id'); + $getAll = (array) SavedSearch::get()->addSelect('is_current')->addWhere('has_base', '=', FALSE)->execute()->indexBy('id'); $this->assertTrue($getAll[$current['id']]['is_current']); $this->assertTrue($getAll[$indefinite['id']]['is_current']); -- 2.25.1