cleanup(['tablesToTruncate' => $relatedTables]); $displayNameFormat = '{contact.first_name}{ }{contact.last_name}'; \Civi::settings()->set('display_name_format', $displayNameFormat); return parent::setUpHeadless(); } /** * This locks in a fix to ensure that if a user doesn't have permission to view the is_deleted field that doesn't hard fail if that field happens to be in an APIv4 call. */ public function testIsDeletedPermission(): void { $contact = $this->createLoggedInUser(); \CRM_Core_Config::singleton()->userPermissionClass->permissions = ['access CiviCRM', 'view all contacts']; $originalQuery = civicrm_api4('Contact', 'get', [ 'checkPermissions' => TRUE, 'select' => ['id', 'display_name', 'is_deleted'], 'where' => [['first_name', '=', 'phoney']], ]); try { $isDeletedQuery = civicrm_api4('Contact', 'get', [ 'checkPermissions' => TRUE, 'select' => ['id', 'display_name'], 'where' => [['first_name', '=', 'phoney'], ['is_deleted', '=', 0]], ]); $this->assertEquals(count($originalQuery), count($isDeletedQuery)); } catch (\API_Exception $e) { $this->fail('An Exception Should not have been raised'); } try { $isDeletedJoinTest = civicrm_api4('Email', 'get', [ 'checkPermissions' => TRUE, 'where' => [['contact_id.first_name', '=', 'phoney'], ['contact_id.is_deleted', '=', 0]], ]); } catch (\API_Exception $e) { $this->fail('An Exception Should not have been raised'); } } }