diff --git a/CRM/Contact/BAO/ContactType.php b/CRM/Contact/BAO/ContactType.php index b356a39616ed..4284efa467c1 100644 --- a/CRM/Contact/BAO/ContactType.php +++ b/CRM/Contact/BAO/ContactType.php @@ -67,7 +67,7 @@ public static function isActive($contactType) { public static function basicTypeInfo($includeInactive = FALSE) { $cacheKey = 'CRM_CT_BTI_' . (int) $includeInactive; if (!Civi::cache('contactTypes')->has($cacheKey)) { - $contactType = ContactType::get()->setCheckPermissions(FALSE)->setSelect(['*'])->addWhere('parent_id', 'IS NULL'); + $contactType = ContactType::get(FALSE)->setSelect(['*'])->addWhere('parent_id', 'IS NULL'); if ($includeInactive === FALSE) { $contactType->addWhere('is_active', '=', 1); } @@ -887,7 +887,7 @@ public static function deleteCustomRowsForEntityID($customTable, $entityID) { */ protected static function getAllContactTypes() { if (!Civi::cache('contactTypes')->has('all')) { - $contactTypes = (array) ContactType::get()->setCheckPermissions(FALSE) + $contactTypes = (array) ContactType::get(FALSE) ->setSelect(['id', 'name', 'label', 'description', 'is_active', 'is_reserved', 'image_URL', 'parent_id', 'parent_id:name', 'parent_id:label']) ->execute()->indexBy('name'); diff --git a/CRM/Contact/BAO/SavedSearch.php b/CRM/Contact/BAO/SavedSearch.php index 7e1ddd302e5c..c5cd15e6e4df 100644 --- a/CRM/Contact/BAO/SavedSearch.php +++ b/CRM/Contact/BAO/SavedSearch.php @@ -208,8 +208,7 @@ public static function getFormValues($id) { * @throws \CiviCRM_API3_Exception */ public static function getSearchParams($id) { - $savedSearch = \Civi\Api4\SavedSearch::get() - ->setCheckPermissions(FALSE) + $savedSearch = \Civi\Api4\SavedSearch::get(FALSE) ->addWhere('id', '=', $id) ->execute() ->first(); diff --git a/CRM/Contribute/BAO/ContributionRecur.php b/CRM/Contribute/BAO/ContributionRecur.php index 1b03e98f0abc..c1985a3f1b92 100644 --- a/CRM/Contribute/BAO/ContributionRecur.php +++ b/CRM/Contribute/BAO/ContributionRecur.php @@ -424,8 +424,7 @@ public static function getTemplateContribution($id, $overrides = []) { 'id' => $id, ]); // First look for new-style template contribution with is_template=1 - $templateContributions = \Civi\Api4\Contribution::get() - ->setCheckPermissions(FALSE) + $templateContributions = \Civi\Api4\Contribution::get(FALSE) ->addWhere('contribution_recur_id', '=', $id) ->addWhere('is_template', '=', 1) ->addWhere('is_test', '=', $is_test) @@ -434,8 +433,7 @@ public static function getTemplateContribution($id, $overrides = []) { ->execute(); if (!$templateContributions->count()) { // Fall back to old style template contributions - $templateContributions = \Civi\Api4\Contribution::get() - ->setCheckPermissions(FALSE) + $templateContributions = \Civi\Api4\Contribution::get(FALSE) ->addWhere('contribution_recur_id', '=', $id) ->addWhere('is_test', '=', $is_test) ->addOrderBy('id', 'DESC') diff --git a/CRM/Core/BAO/MessageTemplate.php b/CRM/Core/BAO/MessageTemplate.php index 3348da19a50f..fbbb96709e01 100644 --- a/CRM/Core/BAO/MessageTemplate.php +++ b/CRM/Core/BAO/MessageTemplate.php @@ -416,8 +416,7 @@ public static function sendTemplate($params) { throw new CRM_Core_Exception(ts("Message template's option value or ID missing.")); } - $apiCall = MessageTemplate::get() - ->setCheckPermissions(FALSE) + $apiCall = MessageTemplate::get(FALSE) ->addSelect('msg_subject', 'msg_text', 'msg_html', 'pdf_format_id', 'id') ->addWhere('is_default', '=', 1); diff --git a/CRM/Dedupe/Merger.php b/CRM/Dedupe/Merger.php index 74669495b4e5..f836cfe35277 100644 --- a/CRM/Dedupe/Merger.php +++ b/CRM/Dedupe/Merger.php @@ -598,8 +598,7 @@ public static function moveContactBelongings($mergeHandler, $tables, $tableOpera * @throws \Civi\API\Exception\UnauthorizedException */ protected static function filterRowBasedCustomDataFromCustomTables(array &$cidRefs) { - $customTables = (array) CustomGroup::get() - ->setCheckPermissions(FALSE) + $customTables = (array) CustomGroup::get(FALSE) ->setSelect(['table_name']) ->addWhere('is_multiple', '=', 0) ->addWhere('extends', 'IN', array_merge(['Contact'], CRM_Contact_BAO_ContactType::contactTypes())) diff --git a/CRM/Upgrade/Incremental/php/FiveTwentyEight.php b/CRM/Upgrade/Incremental/php/FiveTwentyEight.php index 31f8b7facbd6..3c040d82b281 100644 --- a/CRM/Upgrade/Incremental/php/FiveTwentyEight.php +++ b/CRM/Upgrade/Incremental/php/FiveTwentyEight.php @@ -66,8 +66,7 @@ public function upgrade_5_28_alpha1($rev) { } public static function populateMissingContactTypeName() { - $contactTypes = \Civi\Api4\ContactType::get() - ->setCheckPermissions(FALSE) + $contactTypes = \Civi\Api4\ContactType::get(FALSE) ->execute(); foreach ($contactTypes as $contactType) { if (empty($contactType['name'])) { diff --git a/CRM/Upgrade/Incremental/php/FiveTwentyOne.php b/CRM/Upgrade/Incremental/php/FiveTwentyOne.php index 499aa9a68f5e..2319acd0ae81 100644 --- a/CRM/Upgrade/Incremental/php/FiveTwentyOne.php +++ b/CRM/Upgrade/Incremental/php/FiveTwentyOne.php @@ -43,7 +43,7 @@ public function setPostUpgradeMessage(&$postUpgradeMessage, $rev) { if ($rev == '5.21.alpha1') { // Find any option groups that were not converted during the upgrade. $notConverted = []; - $optionGroups = \Civi\Api4\OptionGroup::get()->setCheckPermissions(FALSE)->execute(); + $optionGroups = \Civi\Api4\OptionGroup::get(FALSE)->execute(); foreach ($optionGroups as $optionGroup) { $trimmedName = trim($optionGroup['name']); if (strpos($trimmedName, ' ') !== FALSE) { @@ -86,8 +86,7 @@ public function upgrade_5_21_alpha1($rev) { } public static function fixOptionGroupName() { - $optionGroups = \Civi\Api4\OptionGroup::get() - ->setCheckPermissions(FALSE) + $optionGroups = \Civi\Api4\OptionGroup::get(FALSE) ->execute(); foreach ($optionGroups as $optionGroup) { $name = trim($optionGroup['name']); diff --git a/CRM/Utils/Check/Component.php b/CRM/Utils/Check/Component.php index fcd06ca051aa..812d75fea9f9 100644 --- a/CRM/Utils/Check/Component.php +++ b/CRM/Utils/Check/Component.php @@ -35,7 +35,7 @@ public function getChecksConfig() { if (empty($this->checksConfig)) { $this->checksConfig = Civi::cache('checks')->get('checksConfig', []); if (empty($this->checksConfig)) { - $this->checksConfig = StatusPreference::get()->setCheckPermissions(FALSE)->execute()->indexBy('name'); + $this->checksConfig = StatusPreference::get(FALSE)->execute()->indexBy('name'); } } return $this->checksConfig; diff --git a/CRM/Utils/Migrate/Import.php b/CRM/Utils/Migrate/Import.php index 420198d7917b..819fcc0ea005 100644 --- a/CRM/Utils/Migrate/Import.php +++ b/CRM/Utils/Migrate/Import.php @@ -349,8 +349,7 @@ public function customFields(&$xml, &$idMap) { } foreach ($fields_indexed_by_group_id as $group_id => $fields) { - \Civi\Api4\CustomField::save() - ->setCheckPermissions(FALSE) + \Civi\Api4\CustomField::save(FALSE) ->setDefaults(['custom_group_id' => $group_id]) ->setRecords(json_decode(json_encode($fields), TRUE)) ->execute(); diff --git a/Civi/Api4/Action/Setting/AbstractSettingAction.php b/Civi/Api4/Action/Setting/AbstractSettingAction.php index 31e228968224..abbd07ae9aaa 100644 --- a/Civi/Api4/Action/Setting/AbstractSettingAction.php +++ b/Civi/Api4/Action/Setting/AbstractSettingAction.php @@ -73,11 +73,11 @@ protected function validateSettings($domain) { protected function findDomains() { if ($this->domainId == 'all') { - $this->domainId = Domain::get()->setCheckPermissions(FALSE)->addSelect('id')->execute()->column('id'); + $this->domainId = Domain::get(FALSE)->addSelect('id')->execute()->column('id'); } elseif ($this->domainId) { $this->domainId = (array) $this->domainId; - $domains = Domain::get()->setCheckPermissions(FALSE)->addSelect('id')->execute()->column('id'); + $domains = Domain::get(FALSE)->addSelect('id')->execute()->column('id'); $invalid = array_diff($this->domainId, $domains); if ($invalid) { throw new \API_Exception('Invalid domain id: ' . implode(', ', $invalid)); diff --git a/Civi/Api4/Event/Subscriber/ActivityPreCreationSubscriber.php b/Civi/Api4/Event/Subscriber/ActivityPreCreationSubscriber.php index 806a3d451ed4..75dfd1d49b68 100644 --- a/Civi/Api4/Event/Subscriber/ActivityPreCreationSubscriber.php +++ b/Civi/Api4/Event/Subscriber/ActivityPreCreationSubscriber.php @@ -35,8 +35,7 @@ protected function modify(DAOCreateAction $request) { $activityType = $request->getValue('activity_type'); if ($activityType) { \CRM_Core_Error::deprecatedFunctionWarning('Use activity_type_id:name instead of activity_type in APIv4'); - $result = OptionValue::get() - ->setCheckPermissions(FALSE) + $result = OptionValue::get(FALSE) ->addWhere('name', '=', $activityType) ->addWhere('option_group.name', '=', 'activity_type') ->execute(); diff --git a/Civi/Api4/Event/Subscriber/OptionValuePreCreationSubscriber.php b/Civi/Api4/Event/Subscriber/OptionValuePreCreationSubscriber.php index 355738cf86e9..15c070e0b9f0 100644 --- a/Civi/Api4/Event/Subscriber/OptionValuePreCreationSubscriber.php +++ b/Civi/Api4/Event/Subscriber/OptionValuePreCreationSubscriber.php @@ -53,8 +53,7 @@ private function setOptionGroupId(DAOCreateAction $request) { return; } \CRM_Core_Error::deprecatedFunctionWarning('Use option_group_id:name instead of option_group in APIv4'); - $optionGroup = OptionGroup::get() - ->setCheckPermissions(FALSE) + $optionGroup = OptionGroup::get(FALSE) ->addSelect('id') ->addWhere('name', '=', $optionGroupName) ->execute(); diff --git a/Civi/Api4/Generic/Traits/DAOActionTrait.php b/Civi/Api4/Generic/Traits/DAOActionTrait.php index 8db750d13e1c..6497168a3d95 100644 --- a/Civi/Api4/Generic/Traits/DAOActionTrait.php +++ b/Civi/Api4/Generic/Traits/DAOActionTrait.php @@ -221,8 +221,7 @@ protected function getCustomFieldInfo($name) { list($groupName, $fieldName) = explode('.', $name); list($fieldName, $suffix) = array_pad(explode(':', $fieldName), 2, NULL); if (empty(\Civi::$statics['APIv4_Custom_Fields'][$groupName])) { - \Civi::$statics['APIv4_Custom_Fields'][$groupName] = (array) CustomField::get() - ->setCheckPermissions(FALSE) + \Civi::$statics['APIv4_Custom_Fields'][$groupName] = (array) CustomField::get(FALSE) ->addSelect('id', 'name', 'html_type', 'custom_group.extends') ->addWhere('custom_group.name', '=', $groupName) ->execute()->indexBy('name'); diff --git a/Civi/Api4/Service/Schema/Joinable/CustomGroupJoinable.php b/Civi/Api4/Service/Schema/Joinable/CustomGroupJoinable.php index 61b38dccd144..1d2a1287392e 100644 --- a/Civi/Api4/Service/Schema/Joinable/CustomGroupJoinable.php +++ b/Civi/Api4/Service/Schema/Joinable/CustomGroupJoinable.php @@ -59,8 +59,7 @@ public function __construct($targetTable, $alias, $isMultiRecord, $columns) { */ public function getEntityFields() { if (!$this->entityFields) { - $fields = CustomField::get() - ->setCheckPermissions(FALSE) + $fields = CustomField::get(FALSE) ->setSelect(['custom_group.name', 'custom_group.extends', 'custom_group.table_name', '*']) ->addWhere('custom_group.table_name', '=', $this->getTargetTable()) ->execute(); diff --git a/Civi/Api4/Service/Schema/SchemaMapBuilder.php b/Civi/Api4/Service/Schema/SchemaMapBuilder.php index afecc01056ad..e48b976e97b9 100644 --- a/Civi/Api4/Service/Schema/SchemaMapBuilder.php +++ b/Civi/Api4/Service/Schema/SchemaMapBuilder.php @@ -44,7 +44,7 @@ class SchemaMapBuilder { */ public function __construct(EventDispatcherInterface $dispatcher) { $this->dispatcher = $dispatcher; - $this->apiEntities = array_keys((array) Entity::get()->setCheckPermissions(FALSE)->addSelect('name')->execute()->indexBy('name')); + $this->apiEntities = array_keys((array) Entity::get(FALSE)->addSelect('name')->execute()->indexBy('name')); } /** diff --git a/Civi/Api4/Service/Spec/SpecGatherer.php b/Civi/Api4/Service/Spec/SpecGatherer.php index 6116c4c69d05..451a43146d2a 100644 --- a/Civi/Api4/Service/Spec/SpecGatherer.php +++ b/Civi/Api4/Service/Spec/SpecGatherer.php @@ -128,8 +128,7 @@ private function addCustomFields($entity, RequestSpec $specification, $values = if ($entity === 'Participant') { $extends = ['Participant', 'ParticipantRole', 'ParticipantEventName', 'ParticipantEventType']; } - $customFields = CustomField::get() - ->setCheckPermissions(FALSE) + $customFields = CustomField::get(FALSE) ->addWhere('custom_group.extends', 'IN', $extends) ->addWhere('custom_group.is_multiple', '=', '0') ->setSelect(['custom_group.name', '*']) @@ -146,8 +145,7 @@ private function addCustomFields($entity, RequestSpec $specification, $values = * @param \Civi\Api4\Service\Spec\RequestSpec $specification */ private function getCustomGroupFields($customGroup, RequestSpec $specification) { - $customFields = CustomField::get() - ->setCheckPermissions(FALSE) + $customFields = CustomField::get(FALSE) ->addWhere('custom_group.name', '=', $customGroup) ->setSelect(['custom_group.name', 'custom_group.table_name', '*']) ->execute(); diff --git a/ext/search/CRM/Search/Upgrader.php b/ext/search/CRM/Search/Upgrader.php index 8634e2a649b4..7260e39813cf 100644 --- a/ext/search/CRM/Search/Upgrader.php +++ b/ext/search/CRM/Search/Upgrader.php @@ -10,8 +10,7 @@ class CRM_Search_Upgrader extends CRM_Search_Upgrader_Base { * Add menu item when enabled. */ public function enable() { - \Civi\Api4\Navigation::create() - ->setCheckPermissions(FALSE) + \Civi\Api4\Navigation::create(FALSE) ->addValue('parent_id:name', 'Search') ->addValue('label', E::ts('Create Search...')) ->addValue('name', 'create_search') @@ -26,8 +25,7 @@ public function enable() { * Delete menu item when disabled. */ public function disable() { - \Civi\Api4\Navigation::delete() - ->setCheckPermissions(FALSE) + \Civi\Api4\Navigation::delete(FALSE) ->addWhere('name', '=', 'create_search') ->addWhere('domain_id', '=', 'current_domain') ->execute(); diff --git a/ext/sequentialcreditnotes/sequentialcreditnotes.php b/ext/sequentialcreditnotes/sequentialcreditnotes.php index 67bfb11ede98..4e84a7676cdf 100644 --- a/ext/sequentialcreditnotes/sequentialcreditnotes.php +++ b/ext/sequentialcreditnotes/sequentialcreditnotes.php @@ -32,7 +32,7 @@ function sequentialcreditnotes_civicrm_pre($op, $objectName, $id, &$params) { $reversalStatuses = ['Cancelled', 'Chargeback', 'Refunded']; if (empty($params['creditnote_id']) && in_array(CRM_Core_PseudoConstant::getName('CRM_Contribute_BAO_Contribution', 'contribution_status_id', $params['contribution_status_id']), $reversalStatuses, TRUE)) { if ($id) { - $existing = Contribution::get()->setCheckPermissions(FALSE)->addWhere('id', '=', (int) $id)->setSelect(['creditnote_id'])->execute()->first(); + $existing = Contribution::get(FALSE)->addWhere('id', '=', (int) $id)->setSelect(['creditnote_id'])->execute()->first(); if ($existing['creditnote_id']) { // Since we have it adding it makes is clearer. $params['creditnote_id'] = $existing['creditnote_id']; diff --git a/tests/phpunit/CRM/Contact/Form/Task/EmailCommonTest.php b/tests/phpunit/CRM/Contact/Form/Task/EmailCommonTest.php index 65744e848ee6..b13676101089 100644 --- a/tests/phpunit/CRM/Contact/Form/Task/EmailCommonTest.php +++ b/tests/phpunit/CRM/Contact/Form/Task/EmailCommonTest.php @@ -119,7 +119,7 @@ public function testPostProcessWithSignature() { 'This is a test Signature', ]); $mut->stop(); - $activity = Activity::get()->setCheckPermissions(FALSE)->setSelect(['details'])->execute()->first(); + $activity = Activity::get(FALSE)->setSelect(['details'])->execute()->first(); $bccUrl1 = CRM_Utils_System::url('civicrm/contact/view', ['reset' => 1, 'force' => 1, 'cid' => $bcc1], TRUE); $bccUrl2 = CRM_Utils_System::url('civicrm/contact/view', ['reset' => 1, 'force' => 1, 'cid' => $bcc2], TRUE); $this->assertContains("bcc : Mr. Anthony Anderson IIMr. Anthony Anderson II", $activity['details']); diff --git a/tests/phpunit/CRM/Core/BAO/ActionScheduleTest.php b/tests/phpunit/CRM/Core/BAO/ActionScheduleTest.php index 9afad1b53994..d173b7ea941a 100644 --- a/tests/phpunit/CRM/Core/BAO/ActionScheduleTest.php +++ b/tests/phpunit/CRM/Core/BAO/ActionScheduleTest.php @@ -920,7 +920,7 @@ public function testMailer($schedule, $patterns) { )); $activity->save(); - ActivityContact::create()->setCheckPermissions(FALSE)->setValues([ + ActivityContact::create(FALSE)->setValues([ 'contact_id' => $contact['id'], 'activity_id' => $activity->id, 'record_type_id:name' => 'Activity Source', @@ -2583,7 +2583,7 @@ protected function createMembershipFromFixture($fixture, $status, $emailParams = ); $this->assertInternalType('numeric', $membership->id); if ($emailParams) { - Civi\Api4\Email::create()->setCheckPermissions(FALSE)->setValues(array_merge([ + Civi\Api4\Email::create(FALSE)->setValues(array_merge([ 'contact_id' => $membership->contact_id, 'location_type_id' => 1, ], $emailParams))->execute(); diff --git a/tests/phpunit/CRMTraits/Custom/CustomDataTrait.php b/tests/phpunit/CRMTraits/Custom/CustomDataTrait.php index 6f76bd1f23a3..759d62a9d17b 100644 --- a/tests/phpunit/CRMTraits/Custom/CustomDataTrait.php +++ b/tests/phpunit/CRMTraits/Custom/CustomDataTrait.php @@ -50,7 +50,7 @@ public function createCustomGroup($params = []) { 'max_multiple' => 0, ], $params); $identifier = $params['name'] ?? $params['title']; - $this->ids['CustomGroup'][$identifier] = CustomGroup::create()->setCheckPermissions(FALSE)->setValues($params)->execute()->first()['id']; + $this->ids['CustomGroup'][$identifier] = CustomGroup::create(FALSE)->setValues($params)->execute()->first()['id']; return $this->ids['CustomGroup'][$identifier]; } diff --git a/tests/phpunit/api/v3/ACLPermissionTest.php b/tests/phpunit/api/v3/ACLPermissionTest.php index 3035ac86687d..ed1190ee01cc 100644 --- a/tests/phpunit/api/v3/ACLPermissionTest.php +++ b/tests/phpunit/api/v3/ACLPermissionTest.php @@ -1010,8 +1010,7 @@ public function testApi4CustomEntityACL() { $group = uniqid('mg'); $textField = uniqid('tx'); - CustomGroup::create() - ->setCheckPermissions(FALSE) + CustomGroup::create(FALSE) ->addValue('name', $group) ->addValue('extends', 'Contact') ->addValue('is_multiple', TRUE) diff --git a/tests/phpunit/api/v4/Action/BasicCustomFieldTest.php b/tests/phpunit/api/v4/Action/BasicCustomFieldTest.php index 1d5b6e42477a..fd19d1712e5b 100644 --- a/tests/phpunit/api/v4/Action/BasicCustomFieldTest.php +++ b/tests/phpunit/api/v4/Action/BasicCustomFieldTest.php @@ -32,15 +32,13 @@ class BasicCustomFieldTest extends BaseCustomValueTest { public function testWithSingleField() { - $customGroup = CustomGroup::create() - ->setCheckPermissions(FALSE) + $customGroup = CustomGroup::create(FALSE) ->addValue('name', 'MyIndividualFields') ->addValue('extends', 'Individual') ->execute() ->first(); - CustomField::create() - ->setCheckPermissions(FALSE) + CustomField::create(FALSE) ->addValue('label', 'FavColor') ->addValue('custom_group_id', $customGroup['id']) ->addValue('html_type', 'Text') @@ -48,13 +46,12 @@ public function testWithSingleField() { ->execute(); // Individual fields should show up when contact_type = null|Individual but not other contact types - $getFields = Contact::getFields()->setCheckPermissions(FALSE); + $getFields = Contact::getFields(FALSE); $this->assertContains('MyIndividualFields.FavColor', $getFields->execute()->column('name')); $this->assertContains('MyIndividualFields.FavColor', $getFields->setValues(['contact_type' => 'Individual'])->execute()->column('name')); $this->assertNotContains('MyIndividualFields.FavColor', $getFields->setValues(['contact_type' => 'Household'])->execute()->column('name')); - $contactId = Contact::create() - ->setCheckPermissions(FALSE) + $contactId = Contact::create(FALSE) ->addValue('first_name', 'Johann') ->addValue('last_name', 'Tester') ->addValue('contact_type', 'Individual') @@ -62,8 +59,7 @@ public function testWithSingleField() { ->execute() ->first()['id']; - $contact = Contact::get() - ->setCheckPermissions(FALSE) + $contact = Contact::get(FALSE) ->addSelect('first_name') ->addSelect('MyIndividualFields.FavColor') ->addWhere('id', '=', $contactId) @@ -78,8 +74,7 @@ public function testWithSingleField() { ->addValue('MyIndividualFields.FavColor', 'Blue') ->execute(); - $contact = Contact::get() - ->setCheckPermissions(FALSE) + $contact = Contact::get(FALSE) ->addSelect('MyIndividualFields.FavColor') ->addWhere('id', '=', $contactId) ->execute() @@ -91,8 +86,7 @@ public function testWithSingleField() { public function testWithTwoFields() { // First custom set - CustomGroup::create() - ->setCheckPermissions(FALSE) + CustomGroup::create(FALSE) ->addValue('name', 'MyContactFields') ->addValue('extends', 'Contact') ->addChain('field1', CustomField::create() @@ -108,8 +102,7 @@ public function testWithTwoFields() { ->execute(); // Second custom set - CustomGroup::create() - ->setCheckPermissions(FALSE) + CustomGroup::create(FALSE) ->addValue('name', 'MyContactFields2') ->addValue('extends', 'Contact') ->addChain('field1', CustomField::create() @@ -124,8 +117,7 @@ public function testWithTwoFields() { ->addValue('data_type', 'String')) ->execute(); - $contactId1 = Contact::create() - ->setCheckPermissions(FALSE) + $contactId1 = Contact::create(FALSE) ->addValue('first_name', 'Johann') ->addValue('last_name', 'Tester') ->addValue('MyContactFields.FavColor', 'Red') @@ -133,8 +125,7 @@ public function testWithTwoFields() { ->execute() ->first()['id']; - $contactId2 = Contact::create() - ->setCheckPermissions(FALSE) + $contactId2 = Contact::create(FALSE) ->addValue('first_name', 'MaryLou') ->addValue('last_name', 'Tester') ->addValue('MyContactFields.FavColor', 'Purple') @@ -142,8 +133,7 @@ public function testWithTwoFields() { ->execute() ->first()['id']; - $contact = Contact::get() - ->setCheckPermissions(FALSE) + $contact = Contact::get(FALSE) ->addSelect('first_name') ->addSelect('MyContactFields.FavColor') ->addSelect('MyContactFields.FavFood') @@ -162,8 +152,7 @@ public function testWithTwoFields() { ->addValue('MyContactFields2.FavColor', 'Orange') ->addValue('MyContactFields2.FavFood', 'Tangerine') ->execute(); - $contact = Contact::get() - ->setCheckPermissions(FALSE) + $contact = Contact::get(FALSE) ->addSelect('MyContactFields.FavColor', 'MyContactFields2.FavColor', 'MyContactFields.FavFood', 'MyContactFields2.FavFood') ->addWhere('id', '=', $contactId1) ->execute() @@ -178,8 +167,7 @@ public function testWithTwoFields() { ->addWhere('id', '=', $contactId1) ->addValue('MyContactFields.FavColor', 'Blue') ->execute(); - $contact = Contact::get() - ->setCheckPermissions(FALSE) + $contact = Contact::get(FALSE) ->addSelect('MyContactFields.FavColor', 'MyContactFields2.FavColor', 'MyContactFields.FavFood', 'MyContactFields2.FavFood') ->addWhere('id', '=', $contactId1) ->execute() @@ -189,8 +177,7 @@ public function testWithTwoFields() { $this->assertEquals('Cherry', $contact['MyContactFields.FavFood']); $this->assertEquals('Tangerine', $contact['MyContactFields2.FavFood']); - $search = Contact::get() - ->setCheckPermissions(FALSE) + $search = Contact::get(FALSE) ->addClause('OR', ['MyContactFields.FavColor', '=', 'Blue'], ['MyContactFields.FavFood', '=', 'Grapes']) ->addSelect('id') ->addOrderBy('id') @@ -199,8 +186,7 @@ public function testWithTwoFields() { $this->assertEquals([$contactId1, $contactId2], array_keys((array) $search)); - $search = Contact::get() - ->setCheckPermissions(FALSE) + $search = Contact::get(FALSE) ->addClause('NOT', ['MyContactFields.FavColor', '=', 'Purple'], ['MyContactFields.FavFood', '=', 'Grapes']) ->addSelect('id') ->addOrderBy('id') @@ -209,8 +195,7 @@ public function testWithTwoFields() { $this->assertNotContains($contactId2, array_keys((array) $search)); - $search = Contact::get() - ->setCheckPermissions(FALSE) + $search = Contact::get(FALSE) ->addClause('NOT', ['MyContactFields.FavColor', '=', 'Purple'], ['MyContactFields.FavFood', '=', 'Grapes']) ->addSelect('id') ->addOrderBy('id') @@ -220,8 +205,7 @@ public function testWithTwoFields() { $this->assertContains($contactId1, array_keys((array) $search)); $this->assertNotContains($contactId2, array_keys((array) $search)); - $search = Contact::get() - ->setCheckPermissions(FALSE) + $search = Contact::get(FALSE) ->setWhere([['NOT', ['OR', [['MyContactFields.FavColor', '=', 'Blue'], ['MyContactFields.FavFood', '=', 'Grapes']]]]]) ->addSelect('id') ->addOrderBy('id') diff --git a/tests/phpunit/api/v4/Action/ComplexQueryTest.php b/tests/phpunit/api/v4/Action/ComplexQueryTest.php index b5b44dc8f19b..569cd000f930 100644 --- a/tests/phpunit/api/v4/Action/ComplexQueryTest.php +++ b/tests/phpunit/api/v4/Action/ComplexQueryTest.php @@ -49,8 +49,7 @@ public function setUpHeadless() { * Expects at least one activity loaded from the data set. */ public function testGetAllHousingSupportActivities() { - $results = Activity::get() - ->setCheckPermissions(FALSE) + $results = Activity::get(FALSE) ->addWhere('activity_type_id:name', '=', 'Phone Call') ->execute(); diff --git a/tests/phpunit/api/v4/Action/ContactChecksumTest.php b/tests/phpunit/api/v4/Action/ContactChecksumTest.php index b3e91ef7c35f..51edd672d839 100644 --- a/tests/phpunit/api/v4/Action/ContactChecksumTest.php +++ b/tests/phpunit/api/v4/Action/ContactChecksumTest.php @@ -29,8 +29,7 @@ class ContactChecksumTest extends \api\v4\UnitTestCase { public function testGetChecksum() { - $contact = Contact::create() - ->setCheckPermissions(FALSE) + $contact = Contact::create(FALSE) ->addValue('first_name', 'Check') ->addValue('last_name', 'Sum') ->addChain('cs', Contact::getChecksum()->setContactId('$id')->setTtl(500), 0) @@ -47,8 +46,7 @@ public function testGetChecksum() { } public function testValidateChecksum() { - $cid = Contact::create() - ->setCheckPermissions(FALSE) + $cid = Contact::create(FALSE) ->addValue('first_name', 'Checker') ->addValue('last_name', 'Sum') ->execute() diff --git a/tests/phpunit/api/v4/Action/ContactGetTest.php b/tests/phpunit/api/v4/Action/ContactGetTest.php index 89730d593857..e7d5ba1adaae 100644 --- a/tests/phpunit/api/v4/Action/ContactGetTest.php +++ b/tests/phpunit/api/v4/Action/ContactGetTest.php @@ -73,21 +73,21 @@ public function testGetWithLimit() { ->setValues(['first_name' => 'Dan', 'last_name' => $last_name]) ->execute()->first(); - $num = Contact::get()->setCheckPermissions(FALSE)->selectRowCount()->execute()->count(); + $num = Contact::get(FALSE)->selectRowCount()->execute()->count(); // The object's count() method will account for all results, ignoring limit & offset, while the array results are limited - $offset1 = Contact::get()->setCheckPermissions(FALSE)->setOffset(1)->execute(); + $offset1 = Contact::get(FALSE)->setOffset(1)->execute(); $this->assertCount($num, $offset1); $this->assertCount($num - 1, (array) $offset1); - $offset2 = Contact::get()->setCheckPermissions(FALSE)->setOffset(2)->execute(); + $offset2 = Contact::get(FALSE)->setOffset(2)->execute(); $this->assertCount($num - 2, (array) $offset2); $this->assertCount($num, $offset2); // With limit, it doesn't fetch total count by default - $limit2 = Contact::get()->setCheckPermissions(FALSE)->setLimit(2)->execute(); + $limit2 = Contact::get(FALSE)->setLimit(2)->execute(); $this->assertCount(2, (array) $limit2); $this->assertCount(2, $limit2); // With limit, you have to trigger the full row count manually - $limit2 = Contact::get()->setCheckPermissions(FALSE)->setLimit(2)->addSelect('sort_name', 'row_count')->execute(); + $limit2 = Contact::get(FALSE)->setLimit(2)->addSelect('sort_name', 'row_count')->execute(); $this->assertCount(2, (array) $limit2); $this->assertCount($num, $limit2); } diff --git a/tests/phpunit/api/v4/Action/CreateCustomValueTest.php b/tests/phpunit/api/v4/Action/CreateCustomValueTest.php index 9ffcfa6a197f..e4493faf9d3d 100644 --- a/tests/phpunit/api/v4/Action/CreateCustomValueTest.php +++ b/tests/phpunit/api/v4/Action/CreateCustomValueTest.php @@ -34,15 +34,13 @@ class CreateCustomValueTest extends BaseCustomValueTest { public function testGetWithCustomData() { $optionValues = ['r' => 'Red', 'g' => 'Green', 'b' => 'Blue']; - $customGroup = CustomGroup::create() - ->setCheckPermissions(FALSE) + $customGroup = CustomGroup::create(FALSE) ->addValue('name', 'MyContactFields') ->addValue('extends', 'Contact') ->execute() ->first(); - CustomField::create() - ->setCheckPermissions(FALSE) + CustomField::create(FALSE) ->addValue('label', 'Color') ->addValue('option_values', $optionValues) ->addValue('custom_group_id', $customGroup['id']) @@ -50,8 +48,7 @@ public function testGetWithCustomData() { ->addValue('data_type', 'String') ->execute(); - $customField = CustomField::get() - ->setCheckPermissions(FALSE) + $customField = CustomField::get(FALSE) ->addWhere('label', '=', 'Color') ->execute() ->first(); @@ -59,16 +56,14 @@ public function testGetWithCustomData() { $this->assertNotNull($customField['option_group_id']); $optionGroupId = $customField['option_group_id']; - $optionGroup = OptionGroup::get() - ->setCheckPermissions(FALSE) + $optionGroup = OptionGroup::get(FALSE) ->addWhere('id', '=', $optionGroupId) ->execute() ->first(); $this->assertEquals('Color', $optionGroup['title']); - $createdOptionValues = OptionValue::get() - ->setCheckPermissions(FALSE) + $createdOptionValues = OptionValue::get(FALSE) ->addWhere('option_group_id', '=', $optionGroupId) ->execute() ->getArrayCopy(); diff --git a/tests/phpunit/api/v4/Action/CreateWithOptionGroupTest.php b/tests/phpunit/api/v4/Action/CreateWithOptionGroupTest.php index 9992be8ca70c..1b8ca5568b3d 100644 --- a/tests/phpunit/api/v4/Action/CreateWithOptionGroupTest.php +++ b/tests/phpunit/api/v4/Action/CreateWithOptionGroupTest.php @@ -44,15 +44,13 @@ public function testGetWithCustomData() { $colorField = uniqid('colora'); $foodField = uniqid('fooda'); - $customGroupId = CustomGroup::create() - ->setCheckPermissions(FALSE) + $customGroupId = CustomGroup::create(FALSE) ->addValue('name', $group) ->addValue('extends', 'Contact') ->execute() ->first()['id']; - CustomField::create() - ->setCheckPermissions(FALSE) + CustomField::create(FALSE) ->addValue('label', $colorField) ->addValue('name', $colorField) ->addValue('option_values', ['r' => 'Red', 'g' => 'Green', 'b' => 'Blue']) @@ -61,8 +59,7 @@ public function testGetWithCustomData() { ->addValue('data_type', 'String') ->execute(); - CustomField::create() - ->setCheckPermissions(FALSE) + CustomField::create(FALSE) ->addValue('label', $foodField) ->addValue('name', $foodField) ->addValue('option_values', ['1' => 'Corn', '2' => 'Potatoes', '3' => 'Cheese']) @@ -71,23 +68,20 @@ public function testGetWithCustomData() { ->addValue('data_type', 'String') ->execute(); - $customGroupId = CustomGroup::create() - ->setCheckPermissions(FALSE) + $customGroupId = CustomGroup::create(FALSE) ->addValue('name', 'FinancialStuff') ->addValue('extends', 'Contact') ->execute() ->first()['id']; - CustomField::create() - ->setCheckPermissions(FALSE) + CustomField::create(FALSE) ->addValue('label', 'Salary') ->addValue('custom_group_id', $customGroupId) ->addValue('html_type', 'Number') ->addValue('data_type', 'Money') ->execute(); - Contact::create() - ->setCheckPermissions(FALSE) + Contact::create(FALSE) ->addValue('first_name', 'Jerome') ->addValue('last_name', 'Tester') ->addValue('contact_type', 'Individual') @@ -96,8 +90,7 @@ public function testGetWithCustomData() { ->addValue('FinancialStuff.Salary', 50000) ->execute(); - $result = Contact::get() - ->setCheckPermissions(FALSE) + $result = Contact::get(FALSE) ->addSelect('first_name') ->addSelect("$group.$colorField:label") ->addSelect("$group.$foodField:label") @@ -117,15 +110,13 @@ public function testWithCustomDataForMultipleContacts() { $colorField = uniqid('colorb'); $foodField = uniqid('foodb'); - $customGroupId = CustomGroup::create() - ->setCheckPermissions(FALSE) + $customGroupId = CustomGroup::create(FALSE) ->addValue('name', $group) ->addValue('extends', 'Contact') ->execute() ->first()['id']; - CustomField::create() - ->setCheckPermissions(FALSE) + CustomField::create(FALSE) ->addValue('label', $colorField) ->addValue('name', $colorField) ->addValue('option_values', ['r' => 'Red', 'g' => 'Green', 'b' => 'Blue']) @@ -134,8 +125,7 @@ public function testWithCustomDataForMultipleContacts() { ->addValue('data_type', 'String') ->execute(); - CustomField::create() - ->setCheckPermissions(FALSE) + CustomField::create(FALSE) ->addValue('label', $foodField) ->addValue('name', $foodField) ->addValue('option_values', ['1' => 'Corn', '2' => 'Potatoes', '3' => 'Cheese']) @@ -144,23 +134,20 @@ public function testWithCustomDataForMultipleContacts() { ->addValue('data_type', 'String') ->execute(); - $customGroupId = CustomGroup::create() - ->setCheckPermissions(FALSE) + $customGroupId = CustomGroup::create(FALSE) ->addValue('name', 'FinancialStuff') ->addValue('extends', 'Contact') ->execute() ->first()['id']; - CustomField::create() - ->setCheckPermissions(FALSE) + CustomField::create(FALSE) ->addValue('label', 'Salary') ->addValue('custom_group_id', $customGroupId) ->addValue('html_type', 'Number') ->addValue('data_type', 'Money') ->execute(); - Contact::create() - ->setCheckPermissions(FALSE) + Contact::create(FALSE) ->addValue('first_name', 'Red') ->addValue('last_name', 'Corn') ->addValue('contact_type', 'Individual') @@ -169,8 +156,7 @@ public function testWithCustomDataForMultipleContacts() { ->addValue('FinancialStuff.Salary', 10000) ->execute(); - Contact::create() - ->setCheckPermissions(FALSE) + Contact::create(FALSE) ->addValue('first_name', 'Blue') ->addValue('last_name', 'Cheese') ->addValue('contact_type', 'Individual') @@ -179,8 +165,7 @@ public function testWithCustomDataForMultipleContacts() { ->addValue('FinancialStuff.Salary', 500000) ->execute(); - $result = Contact::get() - ->setCheckPermissions(FALSE) + $result = Contact::get(FALSE) ->addSelect('first_name') ->addSelect('last_name') ->addSelect("$group.$colorField:label") diff --git a/tests/phpunit/api/v4/Action/CustomValuePerformanceTest.php b/tests/phpunit/api/v4/Action/CustomValuePerformanceTest.php index 3701ede4413c..7eb177ff5408 100644 --- a/tests/phpunit/api/v4/Action/CustomValuePerformanceTest.php +++ b/tests/phpunit/api/v4/Action/CustomValuePerformanceTest.php @@ -37,16 +37,14 @@ public function testQueryCount() { $this->markTestIncomplete(); - $customGroupId = CustomGroup::create() - ->setCheckPermissions(FALSE) + $customGroupId = CustomGroup::create(FALSE) ->addValue('name', 'MyContactFields') ->addValue('title', 'MyContactFields') ->addValue('extends', 'Contact') ->execute() ->first()['id']; - CustomField::create() - ->setCheckPermissions(FALSE) + CustomField::create(FALSE) ->addValue('label', 'FavColor') ->addValue('custom_group_id', $customGroupId) ->addValue('options', ['r' => 'Red', 'g' => 'Green', 'b' => 'Blue']) @@ -54,24 +52,21 @@ public function testQueryCount() { ->addValue('data_type', 'String') ->execute(); - CustomField::create() - ->setCheckPermissions(FALSE) + CustomField::create(FALSE) ->addValue('label', 'FavAnimal') ->addValue('custom_group_id', $customGroupId) ->addValue('html_type', 'Text') ->addValue('data_type', 'String') ->execute(); - CustomField::create() - ->setCheckPermissions(FALSE) + CustomField::create(FALSE) ->addValue('label', 'FavLetter') ->addValue('custom_group_id', $customGroupId) ->addValue('html_type', 'Text') ->addValue('data_type', 'String') ->execute(); - CustomField::create() - ->setCheckPermissions(FALSE) + CustomField::create(FALSE) ->addValue('label', 'FavFood') ->addValue('custom_group_id', $customGroupId) ->addValue('html_type', 'Text') @@ -80,8 +75,7 @@ public function testQueryCount() { $this->beginQueryCount(); - Contact::create() - ->setCheckPermissions(FALSE) + Contact::create(FALSE) ->addValue('first_name', 'Red') ->addValue('last_name', 'Tester') ->addValue('contact_type', 'Individual') @@ -91,8 +85,7 @@ public function testQueryCount() { ->addValue('MyContactFields.FavFood', 'Coconuts') ->execute(); - Contact::get() - ->setCheckPermissions(FALSE) + Contact::get(FALSE) ->addSelect('display_name') ->addSelect('MyContactFields.FavColor.label') ->addSelect('MyContactFields.FavColor.weight') diff --git a/tests/phpunit/api/v4/Action/CustomValueTest.php b/tests/phpunit/api/v4/Action/CustomValueTest.php index 2c7e85b6f454..8247f5979480 100644 --- a/tests/phpunit/api/v4/Action/CustomValueTest.php +++ b/tests/phpunit/api/v4/Action/CustomValueTest.php @@ -44,16 +44,14 @@ public function testCRUD() { $multiField = uniqid('chkbx'); $textField = uniqid('txt'); - $customGroup = CustomGroup::create() - ->setCheckPermissions(FALSE) + $customGroup = CustomGroup::create(FALSE) ->addValue('name', $group) ->addValue('extends', 'Contact') ->addValue('is_multiple', TRUE) ->execute() ->first(); - CustomField::create() - ->setCheckPermissions(FALSE) + CustomField::create(FALSE) ->addValue('label', $colorField) ->addValue('option_values', $optionValues) ->addValue('custom_group_id', $customGroup['id']) @@ -61,8 +59,7 @@ public function testCRUD() { ->addValue('data_type', 'String') ->execute(); - CustomField::create() - ->setCheckPermissions(FALSE) + CustomField::create(FALSE) ->addValue('label', $multiField) ->addValue('option_values', $optionValues) ->addValue('custom_group_id', $customGroup['id']) @@ -70,16 +67,14 @@ public function testCRUD() { ->addValue('data_type', 'String') ->execute(); - CustomField::create() - ->setCheckPermissions(FALSE) + CustomField::create(FALSE) ->addValue('label', $textField) ->addValue('custom_group_id', $customGroup['id']) ->addValue('html_type', 'Text') ->addValue('data_type', 'String') ->execute(); - $this->contactID = Contact::create() - ->setCheckPermissions(FALSE) + $this->contactID = Contact::create(FALSE) ->addValue('first_name', 'Johann') ->addValue('last_name', 'Tester') ->addValue('contact_type', 'Individual') @@ -195,8 +190,7 @@ public function testCRUD() { // CASE 3: Test CustomValue::replace // create a second contact which will be used to replace the custom values, created earlier - $secondContactID = Contact::create() - ->setCheckPermissions(FALSE) + $secondContactID = Contact::create(FALSE) ->addValue('first_name', 'Adam') ->addValue('last_name', 'Tester') ->addValue('contact_type', 'Individual') diff --git a/tests/phpunit/api/v4/Action/ExtendFromIndividualTest.php b/tests/phpunit/api/v4/Action/ExtendFromIndividualTest.php index 9a363a19ec82..14ba651b7b75 100644 --- a/tests/phpunit/api/v4/Action/ExtendFromIndividualTest.php +++ b/tests/phpunit/api/v4/Action/ExtendFromIndividualTest.php @@ -32,24 +32,21 @@ class ExtendFromIndividualTest extends BaseCustomValueTest { public function testGetWithNonStandardExtends() { - $customGroup = CustomGroup::create() - ->setCheckPermissions(FALSE) + $customGroup = CustomGroup::create(FALSE) ->addValue('name', 'MyContactFields') // not Contact ->addValue('extends', 'Individual') ->execute() ->first(); - CustomField::create() - ->setCheckPermissions(FALSE) + CustomField::create(FALSE) ->addValue('label', 'FavColor') ->addValue('custom_group_id', $customGroup['id']) ->addValue('html_type', 'Text') ->addValue('data_type', 'String') ->execute(); - $contactId = Contact::create() - ->setCheckPermissions(FALSE) + $contactId = Contact::create(FALSE) ->addValue('first_name', 'Johann') ->addValue('last_name', 'Tester') ->addValue('contact_type', 'Individual') @@ -57,8 +54,7 @@ public function testGetWithNonStandardExtends() { ->execute() ->first()['id']; - $contact = Contact::get() - ->setCheckPermissions(FALSE) + $contact = Contact::get(FALSE) ->addSelect('display_name') ->addSelect('MyContactFields.FavColor') ->addWhere('id', '=', $contactId) diff --git a/tests/phpunit/api/v4/Action/FkJoinTest.php b/tests/phpunit/api/v4/Action/FkJoinTest.php index 602942f93dc4..a7f323537923 100644 --- a/tests/phpunit/api/v4/Action/FkJoinTest.php +++ b/tests/phpunit/api/v4/Action/FkJoinTest.php @@ -49,8 +49,7 @@ public function setUpHeadless() { * loaded from the data set. */ public function testThreeLevelJoin() { - $results = Activity::get() - ->setCheckPermissions(FALSE) + $results = Activity::get(FALSE) ->addWhere('activity_type_id:name', '=', 'Phone Call') ->execute(); @@ -60,11 +59,10 @@ public function testThreeLevelJoin() { public function testOptionalJoin() { // DefaultDataSet includes 2 phones for contact 1, 0 for contact 2. // We'll add one for contact 2 as a red herring to make sure we only get back the correct ones. - Phone::create()->setCheckPermissions(FALSE) + Phone::create(FALSE) ->setValues(['contact_id' => $this->getReference('test_contact_2')['id'], 'phone' => '123456']) ->execute(); - $contacts = Contact::get() - ->setCheckPermissions(FALSE) + $contacts = Contact::get(FALSE) ->addJoin('Phone', FALSE) ->addSelect('id', 'phone.phone') ->addWhere('id', 'IN', [$this->getReference('test_contact_1')['id']]) @@ -77,8 +75,7 @@ public function testOptionalJoin() { public function testRequiredJoin() { // Joining with no condition - $contacts = Contact::get() - ->setCheckPermissions(FALSE) + $contacts = Contact::get(FALSE) ->addSelect('id', 'phone.phone') ->addJoin('Phone', TRUE) ->addWhere('id', 'IN', [$this->getReference('test_contact_1')['id'], $this->getReference('test_contact_2')['id']]) @@ -89,8 +86,7 @@ public function testRequiredJoin() { $this->assertEquals($this->getReference('test_contact_1')['id'], $contacts[1]['id']); // Add is_primary condition, should result in only one record - $contacts = Contact::get() - ->setCheckPermissions(FALSE) + $contacts = Contact::get(FALSE) ->addSelect('id', 'phone.phone', 'phone.location_type_id') ->addJoin('Phone', TRUE, ['phone.is_primary', '=', TRUE]) ->addWhere('id', 'IN', [$this->getReference('test_contact_1')['id'], $this->getReference('test_contact_2')['id']]) @@ -103,14 +99,14 @@ public function testRequiredJoin() { } public function testJoinToTheSameTableTwice() { - $cid1 = Contact::create()->setCheckPermissions(FALSE) + $cid1 = Contact::create(FALSE) ->addValue('first_name', 'Aaa') ->addChain('email1', Email::create()->setValues(['email' => 'yoohoo@yahoo.test', 'contact_id' => '$id', 'location_type_id:name' => 'Home'])) ->addChain('email2', Email::create()->setValues(['email' => 'yahoo@yoohoo.test', 'contact_id' => '$id', 'location_type_id:name' => 'Work'])) ->execute() ->first()['id']; - $cid2 = Contact::create()->setCheckPermissions(FALSE) + $cid2 = Contact::create(FALSE) ->addValue('first_name', 'Bbb') ->addChain('email1', Email::create()->setValues(['email' => '1@test.test', 'contact_id' => '$id', 'location_type_id:name' => 'Home'])) ->addChain('email2', Email::create()->setValues(['email' => '2@test.test', 'contact_id' => '$id', 'location_type_id:name' => 'Work'])) @@ -118,13 +114,12 @@ public function testJoinToTheSameTableTwice() { ->execute() ->first()['id']; - $cid3 = Contact::create()->setCheckPermissions(FALSE) + $cid3 = Contact::create(FALSE) ->addValue('first_name', 'Ccc') ->execute() ->first()['id']; - $contacts = Contact::get() - ->setCheckPermissions(FALSE) + $contacts = Contact::get(FALSE) ->addSelect('id', 'first_name', 'any_email.email', 'any_email.location_type_id:name', 'any_email.is_primary', 'primary_email.email') ->addJoin('Email AS any_email', TRUE) ->addJoin('Email AS primary_email', FALSE, ['primary_email.is_primary', '=', TRUE]) diff --git a/tests/phpunit/api/v4/Action/GetExtraFieldsTest.php b/tests/phpunit/api/v4/Action/GetExtraFieldsTest.php index fbdbd0c5792f..0bff3001c450 100644 --- a/tests/phpunit/api/v4/Action/GetExtraFieldsTest.php +++ b/tests/phpunit/api/v4/Action/GetExtraFieldsTest.php @@ -31,7 +31,7 @@ class GetExtraFieldsTest extends UnitTestCase { public function testGetFieldsByContactType() { - $getFields = Contact::getFields()->setCheckPermissions(FALSE)->addSelect('name')->setIncludeCustom(FALSE); + $getFields = Contact::getFields(FALSE)->addSelect('name')->setIncludeCustom(FALSE); $baseFields = array_column(\CRM_Contact_BAO_Contact::fields(), 'name'); $returnedFields = $getFields->execute()->column('name'); @@ -53,7 +53,7 @@ public function testGetFieldsByContactType() { } public function testGetOptionsAddress() { - $getFields = Address::getFields()->setCheckPermissions(FALSE)->addWhere('name', '=', 'state_province_id')->setLoadOptions(TRUE); + $getFields = Address::getFields(FALSE)->addWhere('name', '=', 'state_province_id')->setLoadOptions(TRUE); $usOptions = $getFields->setValues(['country_id' => 1228])->execute()->first(); diff --git a/tests/phpunit/api/v4/Action/NullValueTest.php b/tests/phpunit/api/v4/Action/NullValueTest.php index d52b2a348888..3a36451d996a 100644 --- a/tests/phpunit/api/v4/Action/NullValueTest.php +++ b/tests/phpunit/api/v4/Action/NullValueTest.php @@ -35,8 +35,7 @@ public function setUpHeadless() { } public function testStringNull() { - $contact = Contact::create() - ->setCheckPermissions(FALSE) + $contact = Contact::create(FALSE) ->addValue('first_name', 'Joseph') ->addValue('last_name', 'null') ->addValue('contact_type', 'Individual') @@ -48,8 +47,7 @@ public function testStringNull() { } public function testSettingToNull() { - $contact = Contact::create() - ->setCheckPermissions(FALSE) + $contact = Contact::create(FALSE) ->addValue('first_name', 'ILoveMy') ->addValue('last_name', 'LastName') ->addValue('contact_type', 'Individual') @@ -59,8 +57,7 @@ public function testSettingToNull() { $this->assertSame('ILoveMy LastName', $contact['display_name']); $contactId = $contact['id']; - $contact = Contact::update() - ->setCheckPermissions(FALSE) + $contact = Contact::update(FALSE) ->addWhere('id', '=', $contactId) ->addValue('last_name', NULL) ->execute() @@ -71,15 +68,13 @@ public function testSettingToNull() { } public function testSaveWithReload() { - $contact = Contact::create() - ->setCheckPermissions(FALSE) + $contact = Contact::create(FALSE) ->addValue('first_name', 'Firsty') ->addValue('last_name', 'Lasty') ->execute() ->first(); - $activity = Activity::create() - ->setCheckPermissions(FALSE) + $activity = Activity::create(FALSE) ->addValue('source_contact_id', $contact['id']) ->addValue('activity_type_id', 1) ->addValue('subject', 'hello') @@ -88,8 +83,7 @@ public function testSaveWithReload() { $this->assertEquals('hello', $activity['subject']); - $saved = Activity::save() - ->setCheckPermissions(FALSE) + $saved = Activity::save(FALSE) ->addRecord(['id' => $activity['id'], 'subject' => NULL]) ->execute() ->first(); @@ -97,8 +91,7 @@ public function testSaveWithReload() { $this->assertNull($saved['subject']); $this->assertArrayNotHasKey('activity_date_time', $saved); - $saved = Activity::save() - ->setCheckPermissions(FALSE) + $saved = Activity::save(FALSE) ->addRecord(['id' => $activity['id'], 'subject' => NULL]) ->setReload(TRUE) ->execute() diff --git a/tests/phpunit/api/v4/Action/PseudoconstantTest.php b/tests/phpunit/api/v4/Action/PseudoconstantTest.php index cd01509d63ec..6602c1fdd341 100644 --- a/tests/phpunit/api/v4/Action/PseudoconstantTest.php +++ b/tests/phpunit/api/v4/Action/PseudoconstantTest.php @@ -36,7 +36,7 @@ class PseudoconstantTest extends BaseCustomValueTest { public function testOptionValue() { - $cid = Contact::create()->setCheckPermissions(FALSE)->addValue('first_name', 'bill')->execute()->first()['id']; + $cid = Contact::create(FALSE)->addValue('first_name', 'bill')->execute()->first()['id']; $subject = uniqid('subject'); OptionValue::create() ->addValue('option_group_id:name', 'activity_type') @@ -99,7 +99,7 @@ public function testOptionValue() { } public function testAddressOptions() { - $cid = Contact::create()->setCheckPermissions(FALSE)->addValue('first_name', 'addr')->execute()->first()['id']; + $cid = Contact::create(FALSE)->addValue('first_name', 'addr')->execute()->first()['id']; Address::save() ->addRecord([ 'contact_id' => $cid, @@ -153,8 +153,7 @@ public function testCustomOptions() { ['id' => 'b', 'name' => 'blue', 'label' => 'BLUE', 'color' => '#0000ff', 'description' => 'Blue color', 'icon' => 'fa-blue'], ]; - CustomGroup::create() - ->setCheckPermissions(FALSE) + CustomGroup::create(FALSE) ->addValue('name', 'myPseudoconstantTest') ->addValue('extends', 'Individual') ->addChain('field1', CustomField::create() @@ -181,14 +180,12 @@ public function testCustomOptions() { } } - $cid = Contact::create() - ->setCheckPermissions(FALSE) + $cid = Contact::create(FALSE) ->addValue('first_name', 'col') ->addValue('myPseudoconstantTest.Color:label', 'blü') ->execute()->first()['id']; - $result = Contact::get() - ->setCheckPermissions(FALSE) + $result = Contact::get(FALSE) ->addWhere('id', '=', $cid) ->addSelect('myPseudoconstantTest.Color:name', 'myPseudoconstantTest.Color:label', 'myPseudoconstantTest.Color') ->execute()->first(); @@ -197,27 +194,23 @@ public function testCustomOptions() { $this->assertEquals('bl_', $result['myPseudoconstantTest.Color:name']); $this->assertEquals('b', $result['myPseudoconstantTest.Color']); - $cid1 = Contact::create() - ->setCheckPermissions(FALSE) + $cid1 = Contact::create(FALSE) ->addValue('first_name', 'two') ->addValue('myPseudoconstantTest.Technicolor:label', 'RED') ->execute()->first()['id']; - $cid2 = Contact::create() - ->setCheckPermissions(FALSE) + $cid2 = Contact::create(FALSE) ->addValue('first_name', 'two') ->addValue('myPseudoconstantTest.Technicolor:label', 'GREEN') ->execute()->first()['id']; // Test ordering by label - $result = Contact::get() - ->setCheckPermissions(FALSE) + $result = Contact::get(FALSE) ->addWhere('id', 'IN', [$cid1, $cid2]) ->addSelect('id') ->addOrderBy('myPseudoconstantTest.Technicolor:label') ->execute()->first()['id']; $this->assertEquals($cid2, $result); - $result = Contact::get() - ->setCheckPermissions(FALSE) + $result = Contact::get(FALSE) ->addWhere('id', 'IN', [$cid1, $cid2]) ->addSelect('id') ->addOrderBy('myPseudoconstantTest.Technicolor:label', 'DESC') @@ -226,17 +219,17 @@ public function testCustomOptions() { } public function testJoinOptions() { - $cid1 = Contact::create()->setCheckPermissions(FALSE) + $cid1 = Contact::create(FALSE) ->addValue('first_name', 'Tom') ->addValue('gender_id:label', 'Male') ->addChain('email', Email::create()->setValues(['contact_id' => '$id', 'email' => 'tom@example.com', 'location_type_id:name' => 'Work'])) ->execute()->first()['id']; - $cid2 = Contact::create()->setCheckPermissions(FALSE) + $cid2 = Contact::create(FALSE) ->addValue('first_name', 'Sue') ->addValue('gender_id:name', 'Female') ->addChain('email', Email::create()->setValues(['contact_id' => '$id', 'email' => 'sue@example.com', 'location_type_id:name' => 'Home'])) ->execute()->first()['id']; - $cid3 = Contact::create()->setCheckPermissions(FALSE) + $cid3 = Contact::create(FALSE) ->addValue('first_name', 'Pat') ->addChain('email', Email::create()->setValues(['contact_id' => '$id', 'email' => 'pat@example.com', 'location_type_id:name' => 'Home'])) ->execute()->first()['id']; @@ -266,7 +259,7 @@ public function testJoinOptions() { public function testTagOptions() { $tag = uniqid('tag'); - Tag::create()->setCheckPermissions(FALSE) + Tag::create(FALSE) ->addValue('name', $tag) ->addValue('description', 'colorful') ->addValue('color', '#aabbcc') diff --git a/tests/phpunit/api/v4/Action/ReplaceTest.php b/tests/phpunit/api/v4/Action/ReplaceTest.php index 7448ea01e2eb..7c2747fe5b6a 100644 --- a/tests/phpunit/api/v4/Action/ReplaceTest.php +++ b/tests/phpunit/api/v4/Action/ReplaceTest.php @@ -106,8 +106,7 @@ public function testEmailReplace() { } public function testCustomValueReplace() { - $customGroup = CustomGroup::create() - ->setCheckPermissions(FALSE) + $customGroup = CustomGroup::create(FALSE) ->addValue('name', 'replaceTest') ->addValue('extends', 'Contact') ->addValue('is_multiple', TRUE) @@ -121,8 +120,7 @@ public function testCustomValueReplace() { ->addValue('data_type', 'String') ->execute(); - CustomField::create() - ->setCheckPermissions(FALSE) + CustomField::create(FALSE) ->addValue('label', 'Custom2') ->addValue('custom_group_id', $customGroup['id']) ->addValue('html_type', 'String') diff --git a/tests/phpunit/api/v4/Action/ResultTest.php b/tests/phpunit/api/v4/Action/ResultTest.php index a4594d2facb4..1e343ffe6f94 100644 --- a/tests/phpunit/api/v4/Action/ResultTest.php +++ b/tests/phpunit/api/v4/Action/ResultTest.php @@ -30,7 +30,7 @@ class ResultTest extends UnitTestCase { public function testJsonSerialize() { - $result = Contact::getFields()->setCheckPermissions(FALSE)->setIncludeCustom(FALSE)->execute(); + $result = Contact::getFields(FALSE)->setIncludeCustom(FALSE)->execute(); $json = json_encode($result); $this->assertStringStartsWith('[{"', $json); $this->assertTrue(is_array(json_decode($json))); diff --git a/tests/phpunit/api/v4/Action/SqlFunctionTest.php b/tests/phpunit/api/v4/Action/SqlFunctionTest.php index f948b22db48c..99f08eb710f1 100644 --- a/tests/phpunit/api/v4/Action/SqlFunctionTest.php +++ b/tests/phpunit/api/v4/Action/SqlFunctionTest.php @@ -38,9 +38,8 @@ public function testGetFunctions() { } public function testGroupAggregates() { - $cid = Contact::create()->setCheckPermissions(FALSE)->addValue('first_name', 'bill')->execute()->first()['id']; - Contribution::save() - ->setCheckPermissions(FALSE) + $cid = Contact::create(FALSE)->addValue('first_name', 'bill')->execute()->first()['id']; + Contribution::save(FALSE) ->setDefaults(['contact_id' => $cid, 'financial_type_id' => 1]) ->setRecords([ ['total_amount' => 100, 'receive_date' => '2020-01-01'], @@ -49,8 +48,7 @@ public function testGroupAggregates() { ['total_amount' => 400, 'receive_date' => '2020-01-01'], ]) ->execute(); - $agg = Contribution::get() - ->setCheckPermissions(FALSE) + $agg = Contribution::get(FALSE) ->addGroupBy('contact_id') ->addWhere('contact_id', '=', $cid) ->addSelect('AVG(total_amount) AS average') @@ -68,9 +66,8 @@ public function testGroupAggregates() { } public function testGroupHaving() { - $cid = Contact::create()->setCheckPermissions(FALSE)->addValue('first_name', 'donor')->execute()->first()['id']; - Contribution::save() - ->setCheckPermissions(FALSE) + $cid = Contact::create(FALSE)->addValue('first_name', 'donor')->execute()->first()['id']; + Contribution::save(FALSE) ->setDefaults(['contact_id' => $cid, 'financial_type_id' => 1]) ->setRecords([ ['total_amount' => 100, 'receive_date' => '2020-02-02'], @@ -79,8 +76,7 @@ public function testGroupHaving() { ['total_amount' => 400, 'receive_date' => '2020-04-04'], ]) ->execute(); - $result = Contribution::get() - ->setCheckPermissions(FALSE) + $result = Contribution::get(FALSE) ->addGroupBy('contact_id') ->addGroupBy('receive_date') ->addSelect('contact_id') diff --git a/tests/phpunit/api/v4/Action/UpdateContactTest.php b/tests/phpunit/api/v4/Action/UpdateContactTest.php index ac36a6b74331..fae15476fbd7 100644 --- a/tests/phpunit/api/v4/Action/UpdateContactTest.php +++ b/tests/phpunit/api/v4/Action/UpdateContactTest.php @@ -32,16 +32,14 @@ class UpdateContactTest extends UnitTestCase { public function testUpdateWithIdInWhere() { - $contactId = Contact::create() - ->setCheckPermissions(FALSE) + $contactId = Contact::create(FALSE) ->addValue('first_name', 'Johann') ->addValue('last_name', 'Tester') ->addValue('contact_type', 'Individual') ->execute() ->first()['id']; - $contact = Contact::update() - ->setCheckPermissions(FALSE) + $contact = Contact::update(FALSE) ->addWhere('id', '=', $contactId) ->addValue('first_name', 'Testy') ->execute() @@ -51,16 +49,14 @@ public function testUpdateWithIdInWhere() { } public function testUpdateWithIdInValues() { - $contactId = Contact::create() - ->setCheckPermissions(FALSE) + $contactId = Contact::create(FALSE) ->addValue('first_name', 'Bobby') ->addValue('last_name', 'Tester') ->addValue('contact_type', 'Individual') ->execute() ->first()['id']; - $contact = Contact::update() - ->setCheckPermissions(FALSE) + $contact = Contact::update(FALSE) ->addValue('id', $contactId) ->addValue('first_name', 'Billy') ->execute(); diff --git a/tests/phpunit/api/v4/Action/UpdateCustomValueTest.php b/tests/phpunit/api/v4/Action/UpdateCustomValueTest.php index c538f5c6f2e3..086c8b712984 100644 --- a/tests/phpunit/api/v4/Action/UpdateCustomValueTest.php +++ b/tests/phpunit/api/v4/Action/UpdateCustomValueTest.php @@ -33,23 +33,20 @@ class UpdateCustomValueTest extends BaseCustomValueTest { public function testGetWithCustomData() { - $customGroup = CustomGroup::create() - ->setCheckPermissions(FALSE) + $customGroup = CustomGroup::create(FALSE) ->addValue('name', 'MyContactFields') ->addValue('extends', 'Contact') ->execute() ->first(); - CustomField::create() - ->setCheckPermissions(FALSE) + CustomField::create(FALSE) ->addValue('label', 'FavColor') ->addValue('custom_group_id', $customGroup['id']) ->addValue('html_type', 'Text') ->addValue('data_type', 'String') ->execute(); - $contactId = Contact::create() - ->setCheckPermissions(FALSE) + $contactId = Contact::create(FALSE) ->addValue('first_name', 'Red') ->addValue('last_name', 'Tester') ->addValue('contact_type', 'Individual') @@ -57,8 +54,7 @@ public function testGetWithCustomData() { ->execute() ->first()['id']; - Contact::update() - ->setCheckPermissions(FALSE) + Contact::update(FALSE) ->addWhere('id', '=', $contactId) ->addValue('first_name', 'Red') ->addValue('last_name', 'Tester') diff --git a/tests/phpunit/api/v4/Entity/ConformanceTest.php b/tests/phpunit/api/v4/Entity/ConformanceTest.php index 77f56c501498..ec372c4e3740 100644 --- a/tests/phpunit/api/v4/Entity/ConformanceTest.php +++ b/tests/phpunit/api/v4/Entity/ConformanceTest.php @@ -70,7 +70,7 @@ public function setUp() { * @throws \Civi\API\Exception\UnauthorizedException */ public function getEntitiesHitech() { - return $this->toDataProviderArray(Entity::get()->setCheckPermissions(FALSE)->execute()->column('name')); + return $this->toDataProviderArray(Entity::get(FALSE)->execute()->column('name')); } /** @@ -140,8 +140,7 @@ public function testConformance($entity) { * @param string $entity */ protected function checkFields($entityClass, $entity) { - $fields = $entityClass::getFields() - ->setCheckPermissions(FALSE) + $fields = $entityClass::getFields(FALSE) ->setIncludeCustom(FALSE) ->execute() ->indexBy('name'); @@ -158,8 +157,7 @@ protected function checkFields($entityClass, $entity) { * @return array */ protected function checkActions($entityClass) { - $actions = $entityClass::getActions() - ->setCheckPermissions(FALSE) + $actions = $entityClass::getActions(FALSE) ->execute() ->indexBy('name'); @@ -196,8 +194,7 @@ protected function checkCreation($entity, $entityClass) { protected function checkUpdateFailsFromCreate($entityClass, $id) { $exceptionThrown = ''; try { - $entityClass::create() - ->setCheckPermissions(FALSE) + $entityClass::create(FALSE) ->addValue('id', $id) ->execute(); } @@ -213,8 +210,7 @@ protected function checkUpdateFailsFromCreate($entityClass, $id) { * @param string $entity */ protected function checkGet($entityClass, $id, $entity) { - $getResult = $entityClass::get() - ->setCheckPermissions(FALSE) + $getResult = $entityClass::get(FALSE) ->addWhere('id', '=', $id) ->execute(); @@ -229,16 +225,14 @@ protected function checkGet($entityClass, $id, $entity) { * @param string $entity */ protected function checkGetCount($entityClass, $id, $entity) { - $getResult = $entityClass::get() - ->setCheckPermissions(FALSE) + $getResult = $entityClass::get(FALSE) ->addWhere('id', '=', $id) ->selectRowCount() ->execute(); $errMsg = sprintf('%s getCount failed', $entity); $this->assertEquals(1, $getResult->count(), $errMsg); - $getResult = $entityClass::get() - ->setCheckPermissions(FALSE) + $getResult = $entityClass::get(FALSE) ->selectRowCount() ->execute(); $errMsg = sprintf('%s getCount failed', $entity); @@ -282,8 +276,7 @@ protected function checkWrongParamType($entityClass) { * @param int $id */ protected function checkDeletion($entityClass, $id) { - $deleteResult = $entityClass::delete() - ->setCheckPermissions(FALSE) + $deleteResult = $entityClass::delete(FALSE) ->addWhere('id', '=', $id) ->execute(); @@ -297,8 +290,7 @@ protected function checkDeletion($entityClass, $id) { * @param string $entity */ protected function checkPostDelete($entityClass, $id, $entity) { - $getDeletedResult = $entityClass::get() - ->setCheckPermissions(FALSE) + $getDeletedResult = $entityClass::get(FALSE) ->addWhere('id', '=', $id) ->execute(); diff --git a/tests/phpunit/api/v4/Entity/ContactTypeTest.php b/tests/phpunit/api/v4/Entity/ContactTypeTest.php index 9e7efec1982c..f894995ce2bb 100644 --- a/tests/phpunit/api/v4/Entity/ContactTypeTest.php +++ b/tests/phpunit/api/v4/Entity/ContactTypeTest.php @@ -49,8 +49,7 @@ public function testGetReturnsFieldsAppropriateToEachContactType() { ->setCheckPermissions(FALSE) ->execute()->first()['id']; - $result = Contact::get() - ->setCheckPermissions(FALSE) + $result = Contact::get(FALSE) ->addSelect('*', 'prefix_id:label') ->addWhere('id', 'IN', [$indiv, $org, $hh]) ->execute() @@ -76,8 +75,7 @@ public function testGetReturnsFieldsAppropriateToEachContactType() { $this->assertArrayNotHasKey('household_name', $result[$org]); $this->assertArrayNotHasKey('household_name', $result[$indiv]); - $emails = Email::get() - ->setCheckPermissions(FALSE) + $emails = Email::get(FALSE) ->addWhere('contact_id', 'IN', [$indiv, $org, $hh]) ->addSelect('id', 'contact_id', 'contact.*', 'contact.prefix_id:label') ->execute() diff --git a/tests/phpunit/api/v4/Entity/EntityTest.php b/tests/phpunit/api/v4/Entity/EntityTest.php index d1efeca02859..4097dd8854e1 100644 --- a/tests/phpunit/api/v4/Entity/EntityTest.php +++ b/tests/phpunit/api/v4/Entity/EntityTest.php @@ -30,8 +30,7 @@ class EntityTest extends UnitTestCase { public function testEntityGet() { - $result = Entity::get() - ->setCheckPermissions(FALSE) + $result = Entity::get(FALSE) ->execute() ->indexBy('name'); $this->assertArrayHasKey('Entity', $result, @@ -41,8 +40,7 @@ public function testEntityGet() { } public function testEntity() { - $result = Entity::getActions() - ->setCheckPermissions(FALSE) + $result = Entity::getActions(FALSE) ->execute() ->indexBy('name'); $this->assertNotContains( diff --git a/tests/phpunit/api/v4/Entity/ParticipantTest.php b/tests/phpunit/api/v4/Entity/ParticipantTest.php index 31208f8aca8a..08fa0aee78f1 100644 --- a/tests/phpunit/api/v4/Entity/ParticipantTest.php +++ b/tests/phpunit/api/v4/Entity/ParticipantTest.php @@ -41,8 +41,7 @@ public function setUp() { } public function testGetActions() { - $result = Participant::getActions() - ->setCheckPermissions(FALSE) + $result = Participant::getActions(FALSE) ->execute() ->indexBy('name'); @@ -60,7 +59,7 @@ public function testGet() { } // With no records: - $result = Participant::get()->setCheckPermissions(FALSE)->execute(); + $result = Participant::get(FALSE)->execute(); $this->assertEquals(0, $result->count(), "count of empty get is not 0"); // Check that the $result knows what the inputs were @@ -115,8 +114,7 @@ public function testGet() { $secondEventId = $dummy['events'][1]['id']; $firstContactId = $dummy['contacts'][0]['id']; - $firstOnlyResult = Participant::get() - ->setCheckPermissions(FALSE) + $firstOnlyResult = Participant::get(FALSE) ->addClause('AND', ['event_id', '=', $firstEventId]) ->execute(); @@ -124,8 +122,7 @@ public function testGet() { "count of first event is not $expectedFirstEventCount"); // get first two events using different methods - $firstTwo = Participant::get() - ->setCheckPermissions(FALSE) + $firstTwo = Participant::get(FALSE) ->addWhere('event_id', 'IN', [$firstEventId, $secondEventId]) ->execute(); @@ -145,8 +142,7 @@ public function testGet() { "count is too low" ); - $firstParticipantResult = Participant::get() - ->setCheckPermissions(FALSE) + $firstParticipantResult = Participant::get(FALSE) ->addWhere('event_id', '=', $firstEventId) ->addWhere('contact_id', '=', $firstContactId) ->execute(); @@ -156,8 +152,7 @@ public function testGet() { $firstParticipantId = $firstParticipantResult->first()['id']; // get a result which excludes $first_participant - $otherParticipantResult = Participant::get() - ->setCheckPermissions(FALSE) + $otherParticipantResult = Participant::get(FALSE) ->setSelect(['id']) ->addClause('NOT', [ ['event_id', '=', $firstEventId], @@ -167,8 +162,7 @@ public function testGet() { ->indexBy('id'); // check alternate syntax for NOT - $otherParticipantResult2 = Participant::get() - ->setCheckPermissions(FALSE) + $otherParticipantResult2 = Participant::get(FALSE) ->setSelect(['id']) ->addClause('NOT', 'AND', [ ['event_id', '=', $firstEventId], diff --git a/tests/phpunit/api/v4/Entity/SavedSearchTest.php b/tests/phpunit/api/v4/Entity/SavedSearchTest.php index 5c426298efcf..35d3aa0ba98a 100644 --- a/tests/phpunit/api/v4/Entity/SavedSearchTest.php +++ b/tests/phpunit/api/v4/Entity/SavedSearchTest.php @@ -31,8 +31,8 @@ class SavedSearchTest extends UnitTestCase { public function testContactSmartGroup() { - $in = Contact::create()->setCheckPermissions(FALSE)->addValue('first_name', 'yes')->addValue('do_not_phone', TRUE)->execute()->first(); - $out = Contact::create()->setCheckPermissions(FALSE)->addValue('first_name', 'no')->addValue('do_not_phone', FALSE)->execute()->first(); + $in = Contact::create(FALSE)->addValue('first_name', 'yes')->addValue('do_not_phone', TRUE)->execute()->first(); + $out = Contact::create(FALSE)->addValue('first_name', 'no')->addValue('do_not_phone', FALSE)->execute()->first(); $savedSearch = civicrm_api4('SavedSearch', 'create', [ 'values' => [ @@ -57,10 +57,10 @@ public function testContactSmartGroup() { } public function testEmailSmartGroup() { - $in = Contact::create()->setCheckPermissions(FALSE)->addValue('first_name', 'yep')->execute()->first(); - $out = Contact::create()->setCheckPermissions(FALSE)->addValue('first_name', 'nope')->execute()->first(); + $in = Contact::create(FALSE)->addValue('first_name', 'yep')->execute()->first(); + $out = Contact::create(FALSE)->addValue('first_name', 'nope')->execute()->first(); $email = uniqid() . '@' . uniqid(); - Email::create()->setCheckPermissions(FALSE)->addValue('email', $email)->addValue('contact_id', $in['id'])->execute(); + Email::create(FALSE)->addValue('email', $email)->addValue('contact_id', $in['id'])->execute(); $savedSearch = civicrm_api4('SavedSearch', 'create', [ 'values' => [ diff --git a/tests/phpunit/api/v4/Spec/SpecGathererTest.php b/tests/phpunit/api/v4/Spec/SpecGathererTest.php index cd1b4903929f..9233ecc02cc1 100644 --- a/tests/phpunit/api/v4/Spec/SpecGathererTest.php +++ b/tests/phpunit/api/v4/Spec/SpecGathererTest.php @@ -78,8 +78,7 @@ public function testWithSpecProvider() { } public function testPseudoConstantOptionsWillBeAdded() { - $customGroupId = CustomGroup::create() - ->setCheckPermissions(FALSE) + $customGroupId = CustomGroup::create(FALSE) ->addValue('name', 'FavoriteThings') ->addValue('extends', 'Contact') ->execute() @@ -87,8 +86,7 @@ public function testPseudoConstantOptionsWillBeAdded() { $options = ['r' => 'Red', 'g' => 'Green', 'p' => 'Pink']; - CustomField::create() - ->setCheckPermissions(FALSE) + CustomField::create(FALSE) ->addValue('label', 'FavColor') ->addValue('custom_group_id', $customGroupId) ->addValue('option_values', $options)