Merge pull request #19806 from eileenmcnaughton/msg_compat
authorTim Otten <totten@civicrm.org>
Fri, 26 Mar 2021 21:26:34 +0000 (14:26 -0700)
committerGitHub <noreply@github.com>
Fri, 26 Mar 2021 21:26:34 +0000 (14:26 -0700)
Align most of the tokens in the token processor handling with the legacy handling

323 files changed:
CRM/ACL/BAO/ACL.php
CRM/Batch/Form/Entry.php
CRM/Contact/BAO/Group.php
CRM/Contact/BAO/GroupContactCache.php
CRM/Contact/DAO/Group.php
CRM/Contact/DAO/RelationshipCache.php
CRM/Contact/Page/View/Summary.php
CRM/Contribute/BAO/ContributionPage.php
CRM/Contribute/BAO/ContributionRecur.php
CRM/Contribute/Form/Task.php
CRM/Contribute/Form/Task/PDFLetterCommon.php
CRM/Contribute/Form/Task/TaskTrait.php
CRM/Core/Form.php
CRM/Core/Invoke.php
CRM/Core/Payment/AuthorizeNetIPN.php
CRM/Core/Payment/PayPalIPN.php
CRM/Core/Payment/PayPalProIPN.php
CRM/Dedupe/BAO/Rule.php
CRM/Extension/ClassLoader.php
CRM/Extension/Info.php
CRM/Financial/BAO/Order.php
CRM/Member/Form/Membership.php
CRM/Upgrade/Incremental/php/FiveThirtySeven.php
CRM/Upgrade/Incremental/php/FiveThirtySix.php
CRM/Utils/System/Base.php
CRM/Utils/System/Drupal8.php
CRM/Utils/Type.php
Civi/Api4/Action/GetActions.php
Civi/Api4/Generic/AbstractEntity.php
Civi/Api4/Generic/BasicEntity.php
Civi/Api4/Generic/DAOEntity.php
Civi/Api4/MailSettings.php
Civi/Api4/RelationshipCache.php
ang/api4Explorer/Explorer.js
ext/afform/mock/tests/phpunit/api/v4/AfformTestCase.php
ext/search/Civi/Search/Admin.php
ext/search/ang/crmSearchAdmin.module.js
ext/search/ang/crmSearchAdmin/searchList.controller.js
ext/search/ang/crmSearchAdmin/searchList.html
templates/CRM/Contact/Page/View/CustomDataFieldView.tpl
templates/CRM/Contact/Page/View/Summary-tab.tpl [new file with mode: 0644]
templates/CRM/Contact/Page/View/Summary.tpl
templates/CRM/common/TabHeader.tpl
tests/phpunit/CRM/ACL/ListTest.php
tests/phpunit/CRM/Activity/BAO/ActivityAssignmentTest.php
tests/phpunit/CRM/Activity/BAO/ActivityTargetTest.php
tests/phpunit/CRM/Activity/BAO/ActivityTest.php
tests/phpunit/CRM/Activity/Form/ActivityTest.php
tests/phpunit/CRM/Activity/Form/SearchTest.php
tests/phpunit/CRM/Activity/Page/AJAXTest.php
tests/phpunit/CRM/Batch/BAO/BatchTest.php
tests/phpunit/CRM/Batch/Form/EntryTest.php
tests/phpunit/CRM/Case/BAO/CaseTest.php
tests/phpunit/CRM/Case/BAO/CaseTypeForkTest.php
tests/phpunit/CRM/Case/Form/CustomDataTest.php
tests/phpunit/CRM/Case/Form/SearchTest.php
tests/phpunit/CRM/Case/XMLProcessor/ProcessTest.php
tests/phpunit/CRM/Case/XMLProcessor/ReportTest.php
tests/phpunit/CRM/Case/XMLProcessorTest.php
tests/phpunit/CRM/Case/XMLRepositoryTest.php
tests/phpunit/CRM/Contact/BAO/ActivitySearchTest.php
tests/phpunit/CRM/Contact/BAO/ContactTest.php
tests/phpunit/CRM/Contact/BAO/ContactType/ContactSearchTest.php
tests/phpunit/CRM/Contact/BAO/ContactType/ContactTest.php
tests/phpunit/CRM/Contact/BAO/ContactType/ContactTypeTest.php
tests/phpunit/CRM/Contact/BAO/ContactType/RelationshipTest.php
tests/phpunit/CRM/Contact/BAO/GroupContactCacheTest.php
tests/phpunit/CRM/Contact/BAO/GroupContactTest.php
tests/phpunit/CRM/Contact/BAO/GroupTest.php
tests/phpunit/CRM/Contact/BAO/QueryTest.php
tests/phpunit/CRM/Contact/BAO/RelationshipCacheTest.php
tests/phpunit/CRM/Contact/BAO/RelationshipTest.php
tests/phpunit/CRM/Contact/BAO/SavedSearchTest.php
tests/phpunit/CRM/Contact/Form/Search/Custom/GroupTest.php
tests/phpunit/CRM/Contact/Form/Search/Custom/PriceSetTest.php
tests/phpunit/CRM/Contact/Form/Search/Custom/SampleTest.php
tests/phpunit/CRM/Contact/Form/Task/DeleteTest.php
tests/phpunit/CRM/Contact/Form/Task/EmailCommonTest.php
tests/phpunit/CRM/Contact/Form/Task/PrintMailingLabelTest.php
tests/phpunit/CRM/Contact/Import/Parser/ContactTest.php
tests/phpunit/CRM/Contact/Page/AjaxTest.php
tests/phpunit/CRM/Contact/Page/DedupeExceptionTest.php
tests/phpunit/CRM/Contact/Page/View/NoteTest.php
tests/phpunit/CRM/Contact/Page/View/UserDashBoardTest.php
tests/phpunit/CRM/Contact/Page/View/UserDashboard/GroupContactTest.php
tests/phpunit/CRM/Contribute/BAO/ContributionPageTest.php
tests/phpunit/CRM/Contribute/BAO/ContributionTest.php
tests/phpunit/CRM/Contribute/BAO/ContributionTypeTest.php
tests/phpunit/CRM/Contribute/BAO/ProductTest.php
tests/phpunit/CRM/Contribute/BAO/QueryTest.php
tests/phpunit/CRM/Contribute/Form/AdditionalPaymentTest.php
tests/phpunit/CRM/Contribute/Form/Contribution/ConfirmTest.php
tests/phpunit/CRM/Contribute/Form/Contribution/MainTest.php
tests/phpunit/CRM/Contribute/Form/Contribution/ThankYouTest.php
tests/phpunit/CRM/Contribute/Form/ContributionPageTranslationTest.php
tests/phpunit/CRM/Contribute/Form/ContributionTest.php
tests/phpunit/CRM/Contribute/Form/SearchTest.php
tests/phpunit/CRM/Contribute/Form/Task/InvoiceTest.php
tests/phpunit/CRM/Contribute/Form/Task/PDFLetterCommonTest.php
tests/phpunit/CRM/Contribute/Form/Task/StatusTest.php
tests/phpunit/CRM/Contribute/Form/TaskTest.php
tests/phpunit/CRM/Contribute/Import/Parser/ContributionTest.php
tests/phpunit/CRM/Contribute/PseudoConstantTest.php
tests/phpunit/CRM/Core/BAO/CustomFieldTest.php
tests/phpunit/CRM/Core/BAO/CustomQueryTest.php
tests/phpunit/CRM/Core/BAO/LocationTest.php
tests/phpunit/CRM/Core/BAO/MappingTest.php
tests/phpunit/CRM/Core/BAO/OpenIDTest.php
tests/phpunit/CRM/Core/BAO/RecurringEntityTest.php
tests/phpunit/CRM/Core/BAO/SchemaHandlerTest.php
tests/phpunit/CRM/Core/BAO/SettingTest.php
tests/phpunit/CRM/Core/CommunityMessagesTest.php
tests/phpunit/CRM/Core/DAO/AllCoreTablesTest.php
tests/phpunit/CRM/Core/ErrorTest.php
tests/phpunit/CRM/Core/FieldOptionsTest.php
tests/phpunit/CRM/Core/I18n/LocaleTest.php
tests/phpunit/CRM/Core/I18n/SchemaTest.php
tests/phpunit/CRM/Core/InnoDBIndexerTest.php
tests/phpunit/CRM/Core/ManagedEntitiesTest.php
tests/phpunit/CRM/Core/Payment/AuthorizeNetIPNTest.php
tests/phpunit/CRM/Core/Payment/AuthorizeNetTest.php
tests/phpunit/CRM/Core/Payment/BaseIPNTest.php
tests/phpunit/CRM/Core/Payment/PayPalIPNTest.php
tests/phpunit/CRM/Core/Payment/PayPalProIPNTest.php
tests/phpunit/CRM/Core/Payment/PaypalProTest.php
tests/phpunit/CRM/Core/Payment/PaypalStdTest.php
tests/phpunit/CRM/Dedupe/DedupeFinderTest.php
tests/phpunit/CRM/Event/BAO/AdditionalPaymentTest.php
tests/phpunit/CRM/Event/BAO/ChangeFeeSelectionTest.php
tests/phpunit/CRM/Event/BAO/ParticipantStatusTest.php
tests/phpunit/CRM/Event/Form/SearchTest.php
tests/phpunit/CRM/Export/BAO/ExportTest.php
tests/phpunit/CRM/Extension/BrowserTest.php
tests/phpunit/CRM/Extension/Container/BasicTest.php
tests/phpunit/CRM/Extension/Container/CollectionTest.php
tests/phpunit/CRM/Extension/Container/StaticTest.php
tests/phpunit/CRM/Extension/InfoTest.php
tests/phpunit/CRM/Extension/Manager/ModuleTest.php
tests/phpunit/CRM/Extension/Manager/PaymentTest.php
tests/phpunit/CRM/Extension/Manager/ReportTest.php
tests/phpunit/CRM/Extension/Manager/SearchTest.php
tests/phpunit/CRM/Extension/ManagerTest.php
tests/phpunit/CRM/Extension/MapperTest.php
tests/phpunit/CRM/Financial/BAO/FinancialItemTest.php
tests/phpunit/CRM/Financial/BAO/FinancialTypeTest.php
tests/phpunit/CRM/Financial/Form/PaymentEditTest.php
tests/phpunit/CRM/Group/Page/AjaxTest.php
tests/phpunit/CRM/Logging/LoggingTest.php
tests/phpunit/CRM/Logging/SchemaTest.php
tests/phpunit/CRM/Mailing/BAO/MailingTest.php
tests/phpunit/CRM/Mailing/BAO/QueryTest.php
tests/phpunit/CRM/Mailing/BAO/SpoolTest.php
tests/phpunit/CRM/Mailing/BaseMailingSystemTest.php
tests/phpunit/CRM/Mailing/MailStoreTest.php
tests/phpunit/CRM/Mailing/MailingSystemTest.php
tests/phpunit/CRM/Member/BAO/MembershipLogTest.php
tests/phpunit/CRM/Member/BAO/MembershipStatusTest.php
tests/phpunit/CRM/Member/BAO/MembershipTest.php
tests/phpunit/CRM/Member/BAO/MembershipTypeTest.php
tests/phpunit/CRM/Member/Form/MembershipTest.php
tests/phpunit/CRM/Member/Form/Task/BatchTest.php
tests/phpunit/CRM/Member/Form/Task/PDFLetterCommonTest.php
tests/phpunit/CRM/Member/Import/Parser/MembershipTest.php
tests/phpunit/CRM/PCP/BAO/PCPTest.php
tests/phpunit/CRM/Pledge/BAO/PledgeBlockTest.php
tests/phpunit/CRM/Pledge/BAO/PledgePaymentTest.php
tests/phpunit/CRM/Pledge/BAO/PledgeTest.php
tests/phpunit/CRM/Pledge/Form/SearchTest.php
tests/phpunit/CRM/Price/BAO/PriceFieldValueTest.php
tests/phpunit/CRM/Price/BAO/PriceSetTest.php
tests/phpunit/CRM/Queue/Queue/SqlTest.php
tests/phpunit/CRM/Queue/QueueTest.php
tests/phpunit/CRM/Queue/RunnerTest.php
tests/phpunit/CRM/Report/Form/ActivityTest.php
tests/phpunit/CRM/Report/Form/ContactSummaryTest.php
tests/phpunit/CRM/Report/FormTest.php
tests/phpunit/CRM/SMS/BAO/ProviderTest.php
tests/phpunit/CRM/SMS/PreviewTest.php
tests/phpunit/CRM/SMS/ProviderTest.php
tests/phpunit/CRM/Upgrade/Incremental/BaseTest.php
tests/phpunit/CRM/Upgrade/Incremental/php/FiveTwentyTest.php
tests/phpunit/CRM/Utils/API/MatchOptionTest.php
tests/phpunit/CRM/Utils/Cache/SqlGroupTest.php
tests/phpunit/CRM/Utils/DateTest.php
tests/phpunit/CRM/Utils/HookTest.php
tests/phpunit/CRM/Utils/HttpClientTest.php
tests/phpunit/CRM/Utils/Mail/EmailProcessorInboundTest.php
tests/phpunit/CRM/Utils/Mail/EmailProcessorTest.php
tests/phpunit/CRM/Utils/Migrate/ImportExportTest.php
tests/phpunit/CRM/Utils/ZipTest.php
tests/phpunit/CRM/Utils/versionCheckTest.php
tests/phpunit/Civi/CCase/SequenceListenerTest.php
tests/phpunit/Civi/Core/CiviFacadeTest.php
tests/phpunit/Civi/Core/Event/GenericHookEventTest.php
tests/phpunit/Civi/Core/SettingsBagTest.php
tests/phpunit/Civi/Core/SettingsManagerTest.php
tests/phpunit/Civi/Core/SettingsStackTest.php
tests/phpunit/Civi/Test/ExampleHookTest.php
tests/phpunit/Civi/Test/ExampleTransactionalTest.php
tests/phpunit/CiviTest/CiviCaseTestCase.php
tests/phpunit/CiviTest/CiviReportTestCase.php
tests/phpunit/CiviTest/CiviUnitTestCase.php
tests/phpunit/E2E/Cache/TieredTest.php
tests/phpunit/E2E/Cache/TwoInstancesTest.php
tests/phpunit/E2E/Core/PrevNextTest.php
tests/phpunit/E2E/Extern/CliRunnerTest.php
tests/phpunit/E2E/Extern/RestTest.php
tests/phpunit/api/v3/ACLCachingTest.php
tests/phpunit/api/v3/ACLPermissionTest.php
tests/phpunit/api/v3/APIWrapperTest.php
tests/phpunit/api/v3/ActionScheduleTest.php
tests/phpunit/api/v3/ActivityCaseTest.php
tests/phpunit/api/v3/ActivityContactTest.php
tests/phpunit/api/v3/ActivityTest.php
tests/phpunit/api/v3/ActivityTypeTest.php
tests/phpunit/api/v3/AddressTest.php
tests/phpunit/api/v3/AttachmentTest.php
tests/phpunit/api/v3/BatchTest.php
tests/phpunit/api/v3/CRM11793Test.php
tests/phpunit/api/v3/CampaignTest.php
tests/phpunit/api/v3/CaseContactTest.php
tests/phpunit/api/v3/CaseTest.php
tests/phpunit/api/v3/CaseTypeTest.php
tests/phpunit/api/v3/ConstantTest.php
tests/phpunit/api/v3/ContactTypeTest.php
tests/phpunit/api/v3/ContributionPageTest.php
tests/phpunit/api/v3/ContributionRecurTest.php
tests/phpunit/api/v3/ContributionSoftTest.php
tests/phpunit/api/v3/ContributionTest.php
tests/phpunit/api/v3/CountryTest.php
tests/phpunit/api/v3/CustomApiTest.php
tests/phpunit/api/v3/CustomFieldTest.php
tests/phpunit/api/v3/CustomGroupTest.php
tests/phpunit/api/v3/CustomSearchTest.php
tests/phpunit/api/v3/CustomValueContactTypeTest.php
tests/phpunit/api/v3/CustomValueTest.php
tests/phpunit/api/v3/DashboardContactTest.php
tests/phpunit/api/v3/DashboardTest.php
tests/phpunit/api/v3/DomainTest.php
tests/phpunit/api/v3/EmailTest.php
tests/phpunit/api/v3/EntityBatchTest.php
tests/phpunit/api/v3/EntityJoinTest.php
tests/phpunit/api/v3/EntityTagACLTest.php
tests/phpunit/api/v3/EntityTagTest.php
tests/phpunit/api/v3/EventTest.php
tests/phpunit/api/v3/ExceptionTest.php
tests/phpunit/api/v3/ExtensionTest.php
tests/phpunit/api/v3/FinancialTypeACLTest.php
tests/phpunit/api/v3/GrantTest.php
tests/phpunit/api/v3/GroupContactTest.php
tests/phpunit/api/v3/GroupNestingTest.php
tests/phpunit/api/v3/GroupOrganizationTest.php
tests/phpunit/api/v3/GroupTest.php
tests/phpunit/api/v3/ImTest.php
tests/phpunit/api/v3/JobProcessMailingTest.php
tests/phpunit/api/v3/JobProcessMembershipTest.php
tests/phpunit/api/v3/JobTestCustomDataTest.php
tests/phpunit/api/v3/LineItemTest.php
tests/phpunit/api/v3/LocBlockTest.php
tests/phpunit/api/v3/LoggingTest.php
tests/phpunit/api/v3/MailSettingsTest.php
tests/phpunit/api/v3/MailingABTest.php
tests/phpunit/api/v3/MailingContactTest.php
tests/phpunit/api/v3/MailingGroupTest.php
tests/phpunit/api/v3/MailingTest.php
tests/phpunit/api/v3/MappingFieldTest.php
tests/phpunit/api/v3/MappingTest.php
tests/phpunit/api/v3/MembershipPaymentTest.php
tests/phpunit/api/v3/MembershipStatusTest.php
tests/phpunit/api/v3/MembershipTest.php
tests/phpunit/api/v3/MembershipTypeTest.php
tests/phpunit/api/v3/MessageTemplateTest.php
tests/phpunit/api/v3/MultilingualTest.php
tests/phpunit/api/v3/NoteTest.php
tests/phpunit/api/v3/OpenIDTest.php
tests/phpunit/api/v3/OptionGroupTest.php
tests/phpunit/api/v3/OptionValueTest.php
tests/phpunit/api/v3/OrderTest.php
tests/phpunit/api/v3/ParticipantPaymentTest.php
tests/phpunit/api/v3/ParticipantStatusTypeTest.php
tests/phpunit/api/v3/ParticipantTest.php
tests/phpunit/api/v3/PaymentProcessorTest.php
tests/phpunit/api/v3/PaymentProcessorTypeTest.php
tests/phpunit/api/v3/PaymentTest.php
tests/phpunit/api/v3/PaymentTokenTest.php
tests/phpunit/api/v3/PcpTest.php
tests/phpunit/api/v3/PhoneTest.php
tests/phpunit/api/v3/PledgePaymentTest.php
tests/phpunit/api/v3/PledgeTest.php
tests/phpunit/api/v3/PriceFieldTest.php
tests/phpunit/api/v3/PriceFieldValueTest.php
tests/phpunit/api/v3/PriceSetTest.php
tests/phpunit/api/v3/ProductTest.php
tests/phpunit/api/v3/ProfileTest.php
tests/phpunit/api/v3/RelationshipTest.php
tests/phpunit/api/v3/RelationshipTypeTest.php
tests/phpunit/api/v3/ReportTemplateTest.php
tests/phpunit/api/v3/SavedSearchTest.php
tests/phpunit/api/v3/SelectQueryTest.php
tests/phpunit/api/v3/SettingTest.php
tests/phpunit/api/v3/StateProvinceTest.php
tests/phpunit/api/v3/StatusPreferenceTest.php
tests/phpunit/api/v3/SurveyRespondantTest.php
tests/phpunit/api/v3/SurveyTest.php
tests/phpunit/api/v3/SyntaxConformanceTest.php
tests/phpunit/api/v3/SystemCheckTest.php
tests/phpunit/api/v3/SystemTest.php
tests/phpunit/api/v3/TagTest.php
tests/phpunit/api/v3/TaxContributionPageTest.php
tests/phpunit/api/v3/UFFieldTest.php
tests/phpunit/api/v3/UFGroupTest.php
tests/phpunit/api/v3/UFJoinTest.php
tests/phpunit/api/v3/UFMatchTest.php
tests/phpunit/api/v3/UserTest.php
tests/phpunit/api/v3/UtilsTest.php
tests/phpunit/api/v3/ValidateTest.php
tests/phpunit/api/v3/WebsiteTest.php
tests/phpunit/api/v4/Action/ChainTest.php
tests/phpunit/api/v4/Action/FkJoinTest.php
tests/phpunit/api/v4/Traits/OptionCleanupTrait.php
tests/phpunit/api/v4/UnitTestCase.php
xml/schema/Contact/Group.xml
xml/schema/Contact/RelationshipCache.xml

index 6f182367093ee344dd6276116950a156bd94d5ea..18bc8023aa64551c2fb5908cee44c61faf17d8f8 100644 (file)
  *  Access Control List
  */
 class CRM_ACL_BAO_ACL extends CRM_ACL_DAO_ACL {
-  /**
-   * @var string
-   */
-  public static $_entityTable = NULL;
-  public static $_objectTable = NULL;
-  public static $_operation = NULL;
-
-  public static $_fieldKeys = NULL;
 
   /**
    * Available operations for  pseudoconstant.
    *
    * @return array
    */
-  public static function operation() {
-    if (!self::$_operation) {
-      self::$_operation = [
-        'View' => ts('View'),
-        'Edit' => ts('Edit'),
-        'Create' => ts('Create'),
-        'Delete' => ts('Delete'),
-        'Search' => ts('Search'),
-        'All' => ts('All'),
-      ];
-    }
-    return self::$_operation;
-  }
-
-  /**
-   * Construct an associative array of an ACL rule's properties
-   *
-   * @param string $format
-   *   Sprintf format for array.
-   * @param bool $hideEmpty
-   *   Only return elements that have a value set.
-   *
-   * @return array
-   *   Assoc. array of the ACL rule's properties
-   */
-  public function toArray($format = '%s', $hideEmpty = FALSE) {
-    $result = [];
-
-    if (!self::$_fieldKeys) {
-      $fields = CRM_ACL_DAO_ACL::fields();
-      self::$_fieldKeys = array_keys($fields);
-    }
-
-    foreach (self::$_fieldKeys as $field) {
-      $result[$field] = $this->$field;
-    }
-    return $result;
-  }
-
-  /**
-   * Get all of the ACLs through ACL groups.
-   *
-   * @param int $contact_id
-   *   ID of a contact to search for.
-   *
-   * @return array
-   *   Array of assoc. arrays of ACL rules
-   *
-   * @throws \CRM_Core_Exception
-   */
-  protected static function getACLRoles($contact_id = NULL) {
-    $contact_id = CRM_Utils_Type::escape($contact_id, 'Integer');
-
-    $query = 'SELECT acl.* FROM civicrm_acl acl';
-    $where = ['acl.entity_table = "civicrm_acl_role" AND acl.entity_id IN (' . implode(',', array_keys(CRM_Core_OptionGroup::values('acl_role'))) . ')'];
-
-    if (!empty($contact_id)) {
-      return [];
-    }
-
-    $results = [];
-
-    $rule = CRM_Core_DAO::executeQuery($query . ' WHERE ' . implode(' AND ', $where));
-
-    while ($rule->fetch()) {
-      $results[$rule->id] = $rule->toArray();
-    }
-
-    return $results;
-  }
-
-  /**
-   * Get all ACLs granted to a contact through all group memberships.
-   *
-   * @param int $contact_id
-   *   The contact's ID.
-   * @param bool $aclRoles
-   *   Include ACL Roles?.
-   *
-   * @return array
-   *   Assoc array of ACL rules
-   * @throws \CRM_Core_Exception
-   */
-  protected static function getGroupACLs($contact_id, $aclRoles = FALSE) {
-    $contact_id = CRM_Utils_Type::escape($contact_id, 'Integer');
-
-    $results = [];
-
-    if ($contact_id) {
-      $query = "
-SELECT      acl.*
-  FROM      civicrm_acl acl
- INNER JOIN  civicrm_group_contact group_contact
-        ON  acl.entity_id      = group_contact.group_id
-     WHERE  acl.entity_table   = 'civicrm_group'
-       AND  group_contact.contact_id     = $contact_id
-       AND  group_contact.status         = 'Added'";
-
-      $rule = CRM_Core_DAO::executeQuery($query);
-
-      while ($rule->fetch()) {
-        $results[$rule->id] = $rule->toArray();
-      }
-    }
-
-    if ($aclRoles) {
-      $results += self::getGroupACLRoles($contact_id);
-    }
-
-    return $results;
+  public static function operation(): array {
+    return [
+      'View' => ts('View'),
+      'Edit' => ts('Edit'),
+      'Create' => ts('Create'),
+      'Delete' => ts('Delete'),
+      'Search' => ts('Search'),
+      'All' => ts('All'),
+    ];
   }
 
   /**
@@ -213,7 +104,7 @@ SELECT acl.*
   /**
    * Get all ACLs owned by a given contact, including domain and group-level.
    *
-   * @param int $contact_id
+   * @param int|null $contact_id
    *   The contact ID.
    *
    * @return array
@@ -221,7 +112,7 @@ SELECT acl.*
    *
    * @throws \CRM_Core_Exception
    */
-  public static function getAllByContact($contact_id) {
+  public static function getAllByContact(?int $contact_id): array {
     $result = [];
 
     /* First, the contact-specific ACLs, including ACL Roles */
@@ -236,13 +127,22 @@ SELECT acl.*
       while ($rule->fetch()) {
         $result[$rule->id] = $rule->toArray();
       }
+      $query = "
+SELECT      acl.*
+  FROM      civicrm_acl acl
+ INNER JOIN  civicrm_group_contact group_contact
+        ON  acl.entity_id      = group_contact.group_id
+     WHERE  acl.entity_table   = 'civicrm_group'
+       AND  group_contact.contact_id     = $contact_id
+       AND  group_contact.status         = 'Added'";
 
-      $result += self::getACLRoles($contact_id);
-    }
-
-    /* Then, all ACLs granted through group membership */
-    $result += self::getGroupACLs($contact_id, TRUE);
+      $rule = CRM_Core_DAO::executeQuery($query);
 
+      while ($rule->fetch()) {
+        $result[$rule->id] = $rule->toArray();
+      }
+    }
+    $result += self::getGroupACLRoles($contact_id);
     return $result;
   }
 
index fe349644421c62960f73b9858280fc9988353820..5435ea65bd66fbe9f5f82888e3a2f0d011fe39d7 100644 (file)
@@ -830,7 +830,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
             'start_date' => $value['membership_start_date'] ?? NULL,
           ];
           $membershipSource = $value['source'] ?? NULL;
-          list($membership) = CRM_Member_BAO_Membership::processMembership(
+          [$membership] = CRM_Member_BAO_Membership::processMembership(
             $value['contact_id'], $value['membership_type_id'], FALSE,
             //$numTerms should be default to 1.
             NULL, NULL, $value['custom'], 1, NULL, FALSE,
@@ -860,7 +860,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
         //process premiums
         if (!empty($value['product_name'])) {
           if ($value['product_name'][0] > 0) {
-            list($products, $options) = CRM_Contribute_BAO_Premium::getPremiumProductInfo();
+            [$products, $options] = CRM_Contribute_BAO_Premium::getPremiumProductInfo();
 
             $value['hidden_Premium'] = 1;
             $value['product_option'] = CRM_Utils_Array::value(
@@ -889,20 +889,99 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
           $value['from_email_address'] = $domainEmail;
           $value['membership_id'] = $membership->id;
           $value['contribution_id'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipPayment', $membership->id, 'contribution_id', 'membership_id');
-          CRM_Member_Form_Membership::emailReceipt($this, $value, $membership);
+          $this->emailReceipt($this, $value, $membership);
         }
       }
     }
     return $batchTotal;
   }
 
+  /**
+   * Send email receipt.
+   *
+   * @param CRM_Core_Form $form
+   *   Form object.
+   * @param array $formValues
+   * @param object $membership
+   *   Object.
+   *
+   * @return bool
+   *   true if mail was sent successfully
+   * @throws \CRM_Core_Exception
+   *
+   * @deprecated
+   *   This function is shared with Batch_Entry which has limited overlap
+   *   & needs rationalising.
+   *
+   */
+  public function emailReceipt($form, &$formValues, $membership) {
+    // retrieve 'from email id' for acknowledgement
+    $receiptFrom = $formValues['from_email_address'] ?? NULL;
+
+    // @todo figure out how much of the stuff below is genuinely shared with the batch form & a logical shared place.
+    if (!empty($formValues['payment_instrument_id'])) {
+      $paymentInstrument = CRM_Contribute_PseudoConstant::paymentInstrument();
+      $formValues['paidBy'] = $paymentInstrument[$formValues['payment_instrument_id']];
+    }
+
+    $form->assign('module', 'Membership');
+    $form->assign('contactID', $formValues['contact_id']);
+
+    $form->assign('membershipID', CRM_Utils_Array::value('membership_id', $form->_params, CRM_Utils_Array::value('membership_id', $form->_defaultValues)));
+
+    if (!empty($formValues['contribution_id'])) {
+      $form->assign('contributionID', $formValues['contribution_id']);
+    }
+
+    if (!empty($formValues['contribution_status_id'])) {
+      $form->assign('contributionStatusID', $formValues['contribution_status_id']);
+      $form->assign('contributionStatus', CRM_Contribute_PseudoConstant::contributionStatus($formValues['contribution_status_id'], 'name'));
+    }
+
+    if (!empty($formValues['is_renew'])) {
+      $form->assign('receiptType', 'membership renewal');
+    }
+    else {
+      $form->assign('receiptType', 'membership signup');
+    }
+    $form->assign('receive_date', CRM_Utils_Array::value('receive_date', $formValues));
+    $form->assign('formValues', $formValues);
+
+    $form->assign('mem_start_date', CRM_Utils_Date::formatDateOnlyLong($membership->start_date));
+    if (!CRM_Utils_System::isNull($membership->end_date)) {
+      $form->assign('mem_end_date', CRM_Utils_Date::formatDateOnlyLong($membership->end_date));
+    }
+    $form->assign('membership_name', CRM_Member_PseudoConstant::membershipType($membership->membership_type_id));
+
+    [$form->_contributorDisplayName, $form->_contributorEmail]
+      = CRM_Contact_BAO_Contact_Location::getEmailDetails($formValues['contact_id']);
+    $form->_receiptContactId = $formValues['contact_id'];
+
+    CRM_Core_BAO_MessageTemplate::sendTemplate(
+      [
+        'groupName' => 'msg_tpl_workflow_membership',
+        'valueName' => 'membership_offline_receipt',
+        'contactId' => $form->_receiptContactId,
+        'from' => $receiptFrom,
+        'toName' => $form->_contributorDisplayName,
+        'toEmail' => $form->_contributorEmail,
+        'PDFFilename' => ts('receipt') . '.pdf',
+        'isEmailPdf' => Civi::settings()->get('invoicing') && Civi::settings()->get('invoice_is_email_pdf'),
+        'contributionId' => $formValues['contribution_id'],
+        'isTest' => (bool) ($form->_action & CRM_Core_Action::PREVIEW),
+      ]
+    );
+
+    return TRUE;
+  }
+
   /**
    * Update contact information.
    *
    * @param array $value
    *   Associated array of submitted values.
    */
-  private function updateContactInfo(&$value) {
+  private function updateContactInfo(array &$value) {
     $value['preserveDBName'] = $this->_preserveDefault;
 
     //parse street address, CRM-7768
index 138fd9e2d3eddf1b682151b3cca386006d9e9980..81feb0f2e3cdd37912bb0a28450b8414f14db270 100644 (file)
@@ -9,6 +9,8 @@
  +--------------------------------------------------------------------+
  */
 
+use Civi\Api4\Group;
+
 /**
  *
  * @package CRM
@@ -94,6 +96,18 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group {
     $query = "DELETE FROM civicrm_acl_entity_role where entity_table = 'civicrm_group' AND entity_id = %1";
     CRM_Core_DAO::executeQuery($query, $params);
 
+    //check whether this group contains  any saved searches and check if that saved search is appropriate to delete.
+    $groupDetails = Group::get(FALSE)->addWhere('id', '=', $id)->execute();
+    if (!empty($groupDetails[0]['saved_search_id'])) {
+      $savedSearch = new CRM_Contact_DAO_SavedSearch();
+      $savedSearch->id = $groupDetails[0]['saved_search_id'];
+      $savedSearch->find(TRUE);
+      // If it is a traditional saved search i.e has form values and there is no linked api_entity then delete the saved search as well.
+      if (!empty($savedSearch->form_values) && empty($savedSearch->api_entity) && empty($savedSearch->api_params)) {
+        $savedSearch->delete();
+      }
+    }
+
     // delete from group table
     $group = new CRM_Contact_DAO_Group();
     $group->id = $id;
index b63e2c49d07cd39ecdb98d2fcfa23a55444cd1b7..defc7400393332ba3f4e087ce647c64d14c3f339 100644 (file)
@@ -483,6 +483,8 @@ WHERE  id IN ( $groupIDs )
       CRM_Core_DAO::executeQuery("INSERT IGNORE INTO $tempTable (group_id, contact_id) {$contactQuery}");
     }
 
+    CRM_Core_DAO::reenableFullGroupByMode();
+
     if ($group->children) {
 
       // Store a list of contacts who are removed from the parent group
index 56f2c52c249cbca98a2fe73cad55aaa647a351c5..b06e64a1687d84f5c702ca3d58df2298a77855cb 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Contact/Group.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:31478cb7fd1eee1299fb22225020be77)
+ * (GenCodeChecksum:8f7306d4427fc261d17944ad601bb422)
  */
 
 /**
index cec645629243b3e0849f682b1f22158e30bf4f48..230049e5e74c432c9c6cf642f1e1400723ace22a 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Contact/RelationshipCache.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:11ec799a538838c310dc75be4427c9f0)
+ * (GenCodeChecksum:6092bd6a166a4209f57a62d71076b0dc)
  */
 
 /**
@@ -190,6 +190,7 @@ class CRM_Contact_DAO_RelationshipCache extends CRM_Core_DAO {
           'html' => [
             'label' => ts("Relationship"),
           ],
+          'readonly' => TRUE,
           'add' => '5.29',
         ],
         'relationship_type_id' => [
@@ -207,6 +208,7 @@ class CRM_Contact_DAO_RelationshipCache extends CRM_Core_DAO {
           'html' => [
             'label' => ts("Relationship Type"),
           ],
+          'readonly' => TRUE,
           'add' => '5.29',
         ],
         'orientation' => [
@@ -225,6 +227,7 @@ class CRM_Contact_DAO_RelationshipCache extends CRM_Core_DAO {
           'pseudoconstant' => [
             'callback' => 'CRM_Core_SelectValues::relationshipOrientation',
           ],
+          'readonly' => TRUE,
           'add' => '5.29',
         ],
         'near_contact_id' => [
@@ -243,6 +246,7 @@ class CRM_Contact_DAO_RelationshipCache extends CRM_Core_DAO {
             'type' => 'EntityRef',
             'label' => ts("Contact (Near side)"),
           ],
+          'readonly' => TRUE,
           'add' => '5.29',
         ],
         'near_relation' => [
@@ -263,6 +267,7 @@ class CRM_Contact_DAO_RelationshipCache extends CRM_Core_DAO {
           'pseudoconstant' => [
             'callback' => 'CRM_Core_PseudoConstant::relationshipTypeOptions',
           ],
+          'readonly' => TRUE,
           'add' => '5.29',
         ],
         'far_contact_id' => [
@@ -281,6 +286,7 @@ class CRM_Contact_DAO_RelationshipCache extends CRM_Core_DAO {
             'type' => 'EntityRef',
             'label' => ts("Contact (Far side)"),
           ],
+          'readonly' => TRUE,
           'add' => '5.29',
         ],
         'far_relation' => [
@@ -301,6 +307,7 @@ class CRM_Contact_DAO_RelationshipCache extends CRM_Core_DAO {
           'pseudoconstant' => [
             'callback' => 'CRM_Core_PseudoConstant::relationshipTypeOptions',
           ],
+          'readonly' => TRUE,
           'add' => '5.29',
         ],
         'is_active' => [
@@ -317,6 +324,7 @@ class CRM_Contact_DAO_RelationshipCache extends CRM_Core_DAO {
           'html' => [
             'type' => 'CheckBox',
           ],
+          'readonly' => TRUE,
           'add' => '5.29',
         ],
         'relationship_start_date' => [
@@ -333,6 +341,7 @@ class CRM_Contact_DAO_RelationshipCache extends CRM_Core_DAO {
             'type' => 'Select Date',
             'formatType' => 'activityDate',
           ],
+          'readonly' => TRUE,
           'add' => '5.29',
         ],
         'relationship_end_date' => [
@@ -349,6 +358,7 @@ class CRM_Contact_DAO_RelationshipCache extends CRM_Core_DAO {
             'type' => 'Select Date',
             'formatType' => 'activityDate',
           ],
+          'readonly' => TRUE,
           'add' => '5.29',
         ],
       ];
index e173a8df5487c082dd883b4adac8b04169fcc04a..dc4ddf1e41f8b7ffd75c537adc153b578e393d26 100644 (file)
@@ -297,7 +297,7 @@ class CRM_Contact_Page_View_Summary extends CRM_Contact_Page_View {
     return [
       [
         'id' => 'summary',
-        'url' => '#contact-summary',
+        'template' => 'CRM/Contact/Page/View/Summary-tab.tpl',
         'title' => ts('Summary'),
         'weight' => 0,
         'icon' => 'crm-i fa-address-card-o',
index 346ca886ab16d327b6cc8be930a8543d17f44d3d..271d0e70a88e76a8a454fac6a0e774fa97f60572 100644 (file)
@@ -15,6 +15,8 @@
  * @copyright CiviCRM LLC https://civicrm.org/licensing
  */
 
+use Civi\Api4\Contribution;
+
 /**
  * This class contains Contribution Page related functions.
  */
@@ -309,7 +311,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio
             $userID = $values['related_contact'] ?? NULL;
           }
         }
-        list($values['customPre_grouptitle'], $values['customPre']) = self::getProfileNameAndFields($preID, $userID, $params['custom_pre_id']);
+        [$values['customPre_grouptitle'], $values['customPre']] = self::getProfileNameAndFields($preID, $userID, $params['custom_pre_id']);
       }
       $userID = $contactID;
       if ($postID = CRM_Utils_Array::value('custom_post_id', $values)) {
@@ -503,55 +505,48 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio
   /**
    * Send the emails for Recurring Contribution Notification.
    *
+   * @param int $contributionID
    * @param string $type
    *   TxnType.
-   * @param int $contactID
-   *   Contact id for contributor.
-   * @param int $pageID
    *   Contribution page id.
    * @param object $recur
    *   Object of recurring contribution table.
    * @param bool|object $autoRenewMembership is it a auto renew membership.
+   *
+   * @throws \API_Exception
    */
-  public static function recurringNotify($type, $contactID, $pageID, $recur, $autoRenewMembership = FALSE) {
-    $value = [];
-    $isEmailReceipt = FALSE;
-    if ($pageID) {
-      CRM_Core_DAO::commonRetrieveAll('CRM_Contribute_DAO_ContributionPage', 'id', $pageID, $value, [
-        'title',
-        'is_email_receipt',
-        'receipt_from_name',
-        'receipt_from_email',
-        'cc_receipt',
-        'bcc_receipt',
-      ]);
-      $isEmailReceipt = $value[$pageID]['is_email_receipt'] ?? NULL;
-    }
-    elseif ($recur->id) {
-      // This means we are coming from back-office - ie. no page ID, but recurring.
-      // Ideally this information would be passed into the function clearly rather than guessing by convention.
-      $isEmailReceipt = TRUE;
-    }
-
-    if ($isEmailReceipt) {
-      if ($pageID) {
-        $receiptFrom = '"' . CRM_Utils_Array::value('receipt_from_name', $value[$pageID]) . '" <' . $value[$pageID]['receipt_from_email'] . '>';
-
-        $receiptFromName = $value[$pageID]['receipt_from_name'];
-        $receiptFromEmail = $value[$pageID]['receipt_from_email'];
+  public static function recurringNotify($contributionID, $type, $recur, $autoRenewMembership = FALSE): void {
+    $contribution = Contribution::get(FALSE)
+      ->addWhere('id', '=', $contributionID)
+      ->setSelect([
+        'contribution_page_id',
+        'contact_id',
+        'contribution_recur_id',
+        'contribution_recur.is_email_receipt',
+        'contribution_page.title',
+        'contribution_page.is_email_receipt',
+        'contribution_page.receipt_from_name',
+        'contribution_page.receipt_from_email',
+        'contribution_page.cc_receipt',
+        'contribution_page.bcc_receipt',
+      ])
+      ->execute()->first();
+
+    if ($contribution['contribution_recur.is_email_receipt'] || $contribution['contribution_page.is_email_receipt']) {
+      if ($contribution['contribution_page.receipt_from_email']) {
+        $receiptFromName = $contribution['contribution_page.receipt_from_name'];
+        $receiptFromEmail = $contribution['contribution_page.receipt_from_email'];
       }
       else {
-        $domainValues = CRM_Core_BAO_Domain::getNameAndEmail();
-        $receiptFrom = "$domainValues[0] <$domainValues[1]>";
-        $receiptFromName = $domainValues[0];
-        $receiptFromEmail = $domainValues[1];
+        [$receiptFromName, $receiptFromEmail] = CRM_Core_BAO_Domain::getNameAndEmail();
       }
 
-      list($displayName, $email) = CRM_Contact_BAO_Contact_Location::getEmailDetails($contactID, FALSE);
+      $receiptFrom = "$receiptFromName <$receiptFromEmail>";
+      [$displayName, $email] = CRM_Contact_BAO_Contact_Location::getEmailDetails($contribution['contact_id'], FALSE);
       $templatesParams = [
         'groupName' => 'msg_tpl_workflow_contribution',
         'valueName' => 'contribution_recurring_notify',
-        'contactId' => $contactID,
+        'contactId' => $contribution['contact_id'],
         'tplParams' => [
           'recur_frequency_interval' => $recur->frequency_interval,
           'recur_frequency_unit' => $recur->frequency_unit,
@@ -570,10 +565,8 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio
         'toEmail' => $email,
       ];
       //CRM-13811
-      if ($pageID) {
-        $templatesParams['cc'] = $value[$pageID]['cc_receipt'] ?? NULL;
-        $templatesParams['bcc'] = $value[$pageID]['bcc_receipt'] ?? NULL;
-      }
+      $templatesParams['cc'] = $contribution['contribution_page.cc_receipt'];
+      $templatesParams['bcc'] = $contribution['contribution_page.cc_receipt'];
       if ($recur->id) {
         // in some cases its just recurringNotify() thats called for the first time and these urls don't get set.
         // like in PaypalPro, & therefore we set it here additionally.
index 161cac49bb89622187e2fa3829f6a90f78eff654..5762a2a0499bff651db8bb100df1b823acad1c20 100644 (file)
@@ -559,9 +559,9 @@ INNER JOIN civicrm_contribution       con ON ( con.id = mp.contribution_id )
       }
 
       //send recurring Notification email for user
-      CRM_Contribute_BAO_ContributionPage::recurringNotify($isFirstOrLastRecurringPayment,
-        $ids['contact'],
-        $ids['contributionPage'],
+      CRM_Contribute_BAO_ContributionPage::recurringNotify(
+        $ids['contribution'],
+        $isFirstOrLastRecurringPayment,
         $recur,
         $autoRenewMembership
       );
index 1cef21bc6cc8bbaf6ffe52820bca164d0fcc1c02..f73b7c0934c7af837490018a3be7c182e8d9f847 100644 (file)
@@ -37,13 +37,6 @@ class CRM_Contribute_Form_Task extends CRM_Core_Form_Task {
    */
   protected $_contributionContactIds = [];
 
-  /**
-   * The flag to tell if there are soft credits included.
-   *
-   * @var bool
-   */
-  public $_includesSoftCredits = FALSE;
-
   /**
    * Build all the data structures needed to build the form.
    */
@@ -66,12 +59,11 @@ class CRM_Contribute_Form_Task extends CRM_Core_Form_Task {
     $ids = $form->getSelectedIDs($values);
     if (!$ids) {
       $result = $form->getSearchQueryResults();
-      $contributionContactIds = $contactIds = [];
       while ($result->fetch()) {
         $ids[] = $result->contribution_id;
-        if ($form->_includesSoftCredits) {
-          $contactIds[$result->contact_id] = $result->contact_id;
-          $contributionContactIds["{$result->contact_id}-{$result->contribution_id}"] = $result->contribution_id;
+        if ($form->isQueryIncludesSoftCredits()) {
+          $form->_contactIds[$result->contact_id] = $result->contact_id;
+          $form->_contributionContactIds["{$result->contact_id}-{$result->contribution_id}"] = $result->contribution_id;
         }
       }
       $form->assign('totalSelectedContributions', $form->get('rowCount'));
@@ -82,10 +74,6 @@ class CRM_Contribute_Form_Task extends CRM_Core_Form_Task {
 
       $form->assign('totalSelectedContributions', count($ids));
     }
-    if (!empty($form->_includesSoftCredits) && !empty($contactIds)) {
-      $form->_contactIds = $contactIds;
-      $form->_contributionContactIds = $contributionContactIds;
-    }
 
     $form->_contributionIds = $form->_componentIds = $ids;
     $form->set('contributionIds', $form->_contributionIds);
@@ -105,8 +93,8 @@ class CRM_Contribute_Form_Task extends CRM_Core_Form_Task {
    * Given the contribution id, compute the contact id
    * since its used for things like send email
    */
-  public function setContactIDs() {
-    if (!$this->_includesSoftCredits) {
+  public function setContactIDs(): void {
+    if (!$this->isQueryIncludesSoftCredits()) {
       $this->_contactIds = CRM_Core_DAO::getContactIDsFromComponent(
         $this->_contributionIds,
         'civicrm_contribution'
index eefb0cb7333a115fc3bba82f5c703d80c77c99db..af0b20f90c249dd37cf14f20f5c523813cdf8d39 100644 (file)
@@ -23,7 +23,7 @@ class CRM_Contribute_Form_Task_PDFLetterCommon extends CRM_Contact_Form_Task_PDF
   /**
    * Process the form after the input has been submitted and validated.
    *
-   * @param CRM_Contribute_Form_Task $form
+   * @param \CRM_Contribute_Form_Task_PDFLetter $form
    * @param array $formValues
    */
   public static function postProcess(&$form, $formValues = NULL) {
@@ -78,11 +78,11 @@ class CRM_Contribute_Form_Task_PDFLetterCommon extends CRM_Contact_Form_Task_PDF
     $skipOnHold = $form->skipOnHold ?? FALSE;
     $skipDeceased = $form->skipDeceased ?? TRUE;
     $contributionIDs = $form->getVar('_contributionIds');
-    if ($form->_includesSoftCredits) {
+    if ($form->isQueryIncludesSoftCredits()) {
       //@todo - comment on what is stored there
       $contributionIDs = $form->getVar('_contributionContactIds');
     }
-    [$contributions, $contacts] = self::buildContributionArray($groupBy, $contributionIDs, $returnProperties, $skipOnHold, $skipDeceased, $messageToken, $task, $separator, $form->_includesSoftCredits);
+    [$contributions, $contacts] = self::buildContributionArray($groupBy, $contributionIDs, $returnProperties, $skipOnHold, $skipDeceased, $messageToken, $task, $separator, $form->isQueryIncludesSoftCredits());
     $html = [];
     $contactHtml = $emailedHtml = [];
     foreach ($contributions as $contributionId => $contribution) {
index 85d17ffe2b3b7ddeea4c2b0c52e2b8690e4641b0..7fd195626952c25549c3047db7a148dd0f891a1a 100644 (file)
  */
 trait CRM_Contribute_Form_Task_TaskTrait {
 
+  /**
+   * Query result object.
+   *
+   * @var \CRM_Core_DAO
+   */
+  protected $queryBAO;
+
   /**
    * Get the results from the BAO_Query object based search.
    *
@@ -28,32 +35,34 @@ trait CRM_Contribute_Form_Task_TaskTrait {
    * @throws \CRM_Core_Exception
    */
   public function getSearchQueryResults(): CRM_Core_DAO {
-    $form = $this;
-    $queryParams = $this->getQueryParams();
-    $returnProperties = ['contribution_id' => 1];
-    $sortOrder = $sortCol = NULL;
-    if ($form->get(CRM_Utils_Sort::SORT_ORDER)) {
-      $sortOrder = $form->get(CRM_Utils_Sort::SORT_ORDER);
-      //Include sort column in select clause.
-      $sortCol = trim(str_replace(['`', 'asc', 'desc'], '', $sortOrder));
-      $returnProperties[$sortCol] = 1;
-    }
+    if (!$this->queryBAO) {
+      $form = $this;
+      $queryParams = $this->getQueryParams();
+      $returnProperties = ['contribution_id' => 1];
+      $sortOrder = $sortCol = NULL;
+      if ($form->get(CRM_Utils_Sort::SORT_ORDER)) {
+        $sortOrder = $form->get(CRM_Utils_Sort::SORT_ORDER);
+        //Include sort column in select clause.
+        $sortCol = trim(str_replace(['`', 'asc', 'desc'], '', $sortOrder));
+        $returnProperties[$sortCol] = 1;
+      }
 
-    $form->_includesSoftCredits = CRM_Contribute_BAO_Query::isSoftCreditOptionEnabled($queryParams);
-    $query = new CRM_Contact_BAO_Query($queryParams, $returnProperties, NULL, FALSE, FALSE,
-      CRM_Contact_BAO_Query::MODE_CONTRIBUTE
-    );
-    // @todo the function CRM_Contribute_BAO_Query::isSoftCreditOptionEnabled should handle this
-    // can we remove? if not why not?
-    if ($form->_includesSoftCredits) {
-      $query->_rowCountClause = " count(civicrm_contribution.id)";
-      $query->_groupByComponentClause = " GROUP BY contribution_search_scredit_combined.id, contribution_search_scredit_combined.contact_id, contribution_search_scredit_combined.scredit_id ";
-    }
-    else {
-      $query->_distinctComponentClause = ' civicrm_contribution.id';
-      $query->_groupByComponentClause = ' GROUP BY civicrm_contribution.id ';
+      $query = new CRM_Contact_BAO_Query($queryParams, $returnProperties, NULL, FALSE, FALSE,
+        CRM_Contact_BAO_Query::MODE_CONTRIBUTE
+      );
+      // @todo the function CRM_Contribute_BAO_Query::isSoftCreditOptionEnabled should handle this
+      // can we remove? if not why not?
+      if ($this->isQueryIncludesSoftCredits()) {
+        $query->_rowCountClause = ' count(civicrm_contribution.id)';
+        $query->_groupByComponentClause = ' GROUP BY contribution_search_scredit_combined.id, contribution_search_scredit_combined.contact_id, contribution_search_scredit_combined.scredit_id ';
+      }
+      else {
+        $query->_distinctComponentClause = ' civicrm_contribution.id';
+        $query->_groupByComponentClause = ' GROUP BY civicrm_contribution.id ';
+      }
+      $this->queryBAO = $query->searchQuery(0, 0, $sortOrder);
     }
-    return $query->searchQuery(0, 0, $sortOrder);
+    return $this->queryBAO;
   }
 
   /**
@@ -81,4 +90,13 @@ trait CRM_Contribute_Form_Task_TaskTrait {
     return $queryParams;
   }
 
+  /**
+   * Has soft credit information been requested in the query filters.
+   *
+   * @return bool
+   */
+  public function isQueryIncludesSoftCredits(): bool {
+    return (bool) CRM_Contribute_BAO_Query::isSoftCreditOptionEnabled($this->getQueryParams());
+  }
+
 }
index c25e991bdce1ee0dae06f9d822bd23181342c12c..84dce6fa352b0c1c58dff5a71682521a6502ed59 100644 (file)
@@ -816,8 +816,8 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
   /**
    * @return int
    */
-  public function getPaymentProcessorID() {
-    return $this->_paymentProcessorID;
+  public function getPaymentProcessorID(): int {
+    return (int) $this->_paymentProcessorID;
   }
 
   /**
index bc537d6b269f9c01d2bc94c318f21d1c6cdabcfc..6611dc00d556a8a10365631caaeb701bfb301037 100644 (file)
@@ -394,6 +394,7 @@ class CRM_Core_Invoke {
       CRM_Utils_Request::retrieve('triggerRebuild', 'Boolean', CRM_Core_DAO::$_nullObject, FALSE, 0, 'GET')
     ) {
       CRM_Core_DAO::triggerRebuild();
+      $config->userSystem->invalidateRouteCache();
     }
     CRM_Core_DAO_AllCoreTables::reinitializeCache(TRUE);
     CRM_Core_ManagedEntities::singleton(TRUE)->reconcile();
index 42a744a9b467a55fac1a43a0d166231901afc8cc..70140f6c4856dfd1a236418d578a0d10d060f4d4 100644 (file)
@@ -88,9 +88,7 @@ class CRM_Core_Payment_AuthorizeNetIPN extends CRM_Core_Payment_BaseIPN {
 
       if ($isFirstOrLastRecurringPayment) {
         //send recurring Notification email for user
-        CRM_Contribute_BAO_ContributionPage::recurringNotify(TRUE,
-          $contributionRecur->contact_id,
-          $ids['contributionPage'],
+        CRM_Contribute_BAO_ContributionPage::recurringNotify($contributionID, TRUE,
           $contributionRecur,
           (bool) $this->getMembershipID($contributionID, $contributionRecur->id)
         );
index 06888f4fce9933b7a15d1e058d2f61f35e2e5f32..6c1d56db99f7e648242cb09c64dbdf3d54fd13cd 100644 (file)
@@ -348,9 +348,9 @@ class CRM_Core_Payment_PayPalIPN extends CRM_Core_Payment_BaseIPN {
         $this->recur($input, $ids, $contributionRecur, $contribution, $first);
         if ($this->getFirstOrLastInSeriesStatus()) {
           //send recurring Notification email for user
-          CRM_Contribute_BAO_ContributionPage::recurringNotify($this->getFirstOrLastInSeriesStatus(),
-            $ids['contact'],
-            $ids['contributionPage'],
+          CRM_Contribute_BAO_ContributionPage::recurringNotify(
+            $ids['contribution'],
+            $this->getFirstOrLastInSeriesStatus(),
             $contributionRecur,
             !empty($ids['membership'])
           );
index 4789c67d35d6a8f2b7e1064d865d75b2175001bd..0ce996e222a1f1088524d541aca142b8cff831e3 100644 (file)
@@ -258,9 +258,9 @@ class CRM_Core_Payment_PayPalProIPN extends CRM_Core_Payment_BaseIPN {
 
     if ($sendNotification) {
       //send recurring Notification email for user
-      CRM_Contribute_BAO_ContributionPage::recurringNotify($subscriptionPaymentStatus,
-        $ids['contact'],
-        $ids['contributionPage'],
+      CRM_Contribute_BAO_ContributionPage::recurringNotify(
+        $ids['contribution'],
+        $subscriptionPaymentStatus,
         $recur,
         !empty($ids['membership'])
       );
index b695d18b6e95f586d5962a949a698520874510a8..6b7f63be7b84b468e87845a18bed06185a4269de 100644 (file)
@@ -65,11 +65,8 @@ class CRM_Dedupe_BAO_Rule extends CRM_Dedupe_DAO_Rule {
       "t2.{$this->rule_field} IS NOT NULL",
       "t1.{$this->rule_field} = t2.{$this->rule_field}",
     ];
-    if ($this->getFieldType($this->rule_field) === CRM_Utils_Type::T_DATE) {
-      $innerJoinClauses[] = "t1.{$this->rule_field} > '1000-01-01'";
-      $innerJoinClauses[] = "t2.{$this->rule_field} > '1000-01-01'";
-    }
-    else {
+
+    if (in_array($this->getFieldType($this->rule_field), CRM_Utils_Type::getTextTypes(), TRUE)) {
       $innerJoinClauses[] = "t1.{$this->rule_field} <> ''";
       $innerJoinClauses[] = "t2.{$this->rule_field} <> ''";
     }
index 2e181a887784b13be254a32e4e665329bbb62da6..5b0f30725e6fa868fdc22ea60f98c1ea9b540cce 100644 (file)
  */
 class CRM_Extension_ClassLoader {
 
+  /**
+   * List of class-loader features that are valid in this version of Civi.
+   *
+   * This may be useful for some extensions which enable/disable polyfills based on environment.
+   */
+  const FEATURES = ',psr0,psr4,';
+
   /**
    * @var CRM_Extension_Mapper
    */
@@ -92,6 +99,10 @@ class CRM_Extension_ClassLoader {
       if (!empty($info->classloader)) {
         foreach ($info->classloader as $mapping) {
           switch ($mapping['type']) {
+            case 'psr0':
+              $loader->add($mapping['prefix'], CRM_Utils_File::addTrailingSlash($path . '/' . $mapping['path']));
+              break;
+
             case 'psr4':
               $loader->addPsr4($mapping['prefix'], $path . '/' . $mapping['path']);
               break;
index 7a0683be43bf6c5539851dbc51269ca741b4e378..67a58af265e9a1155353f3f68e4dd926bf34c0b2 100644 (file)
@@ -175,6 +175,13 @@ class CRM_Extension_Info {
             'path' => (string) $psr4->attributes()->path,
           ];
         }
+        foreach ($val->psr0 as $psr0) {
+          $this->classloader[] = [
+            'type' => 'psr0',
+            'prefix' => (string) $psr0->attributes()->prefix,
+            'path' => (string) $psr0->attributes()->path,
+          ];
+        }
       }
       elseif ($attr === 'tags') {
         $this->tags = [];
index f1d0c771db3775be05406777876597fa5ebbc630..47085372b74b0c524b8b4736bde0773e06586130 100644 (file)
@@ -319,6 +319,27 @@ class CRM_Financial_BAO_Order {
     return $this->lineItems;
   }
 
+  /**
+   * Get line items that specifically relate to memberships.
+   *
+   * return array
+   *
+   * @throws \CiviCRM_API3_Exception
+   */
+  public function getMembershipLineItems():array {
+    $lines = $this->getLineItems();
+    foreach ($lines as $index => $line) {
+      if (empty($line['membership_type_id'])) {
+        unset($lines[$index]);
+        continue;
+      }
+      if (empty($line['membership_num_terms'])) {
+        $lines[$index]['membership_num_terms'] = 1;
+      }
+    }
+    return $lines;
+  }
+
   /**
    * @return array
    * @throws \CiviCRM_API3_Exception
index 926cba87f68a750cdddd9a86e728e3759b9593e0..1d6a53b4174090bd0085d5c379d70b13a1bdbf6d 100644 (file)
@@ -907,7 +907,7 @@ DESC limit 1");
    *   & needs rationalising.
    *
    */
-  public static function emailReceipt($form, &$formValues, $membership) {
+  protected function emailReceipt($form, &$formValues, $membership) {
     // retrieve 'from email id' for acknowledgement
     $receiptFrom = $formValues['from_email_address'] ?? NULL;
 
@@ -1051,16 +1051,6 @@ DESC limit 1");
 
     $params['tax_amount'] = $this->order->getTotalTaxAmount();
     $params['total_amount'] = $this->order->getTotalAmount();
-    if (!empty($lineItem[$this->_priceSetId])) {
-      foreach ($lineItem[$this->_priceSetId] as &$li) {
-        if (!empty($li['membership_type_id'])) {
-          if (!empty($li['membership_num_terms'])) {
-            $termsByType[$li['membership_type_id']] = $li['membership_num_terms'];
-          }
-        }
-      }
-    }
-
     $params['contact_id'] = $this->_contactID;
 
     $params = array_merge($params, $this->getFormMembershipParams());
@@ -1069,14 +1059,10 @@ DESC limit 1");
     $startDate = $formValues['start_date'];
     $endDate = $formValues['end_date'];
 
-    $memTypeNumTerms = empty($termsByType) ? CRM_Utils_Array::value('num_terms', $formValues) : NULL;
-
     $calcDates = [];
-    foreach ($this->_memTypeSelected as $memType) {
-      if (empty($memTypeNumTerms)) {
-        $memTypeNumTerms = CRM_Utils_Array::value($memType, $termsByType, 1);
-      }
-      $calcDates[$memType] = CRM_Member_BAO_MembershipType::getDatesForMembershipType($memType,
+    foreach ($this->order->getMembershipLineItems() as $membershipLineItem) {
+      $memTypeNumTerms = $this->getSubmittedValue('num_terms') ?: $membershipLineItem['membership_num_terms'];
+      $calcDates[$membershipLineItem['membership_type_id']] = CRM_Member_BAO_MembershipType::getDatesForMembershipType($membershipLineItem['membership_type_id'],
         $joinDate, $startDate, $endDate, $memTypeNumTerms
       );
     }
@@ -1167,7 +1153,7 @@ DESC limit 1");
       $params['lineItems'] = $lineItem;
       $params['processPriceSet'] = TRUE;
     }
-    $createdMemberships = [];
+
     if ($this->_mode) {
       $params['total_amount'] = CRM_Utils_Array::value('total_amount', $formValues, 0);
 
@@ -1177,7 +1163,7 @@ DESC limit 1");
       $params['financial_type_id'] = $this->getFinancialTypeID();
 
       //get the payment processor id as per mode. Try removing in favour of beginPostProcess.
-      $params['payment_processor_id'] = $formValues['payment_processor_id'] = $this->_paymentProcessor['id'];
+      $params['payment_processor_id'] = $formValues['payment_processor_id'] = $this->getPaymentProcessorID();
       $params['register_date'] = CRM_Utils_Time::date('YmdHis');
 
       // add all the additional payment params we need
@@ -1287,7 +1273,7 @@ DESC limit 1");
           $membershipTypeValues[$memType]['startDate'] = NULL;
           $membershipTypeValues[$memType]['endDate'] = NULL;
         }
-        $endDate = $startDate = NULL;
+        $startDate = NULL;
       }
       $now = CRM_Utils_Time::date('YmdHis');
       $params['receive_date'] = CRM_Utils_Time::date('Y-m-d H:i:s');
@@ -1349,7 +1335,6 @@ DESC limit 1");
         $params['contribution'] = $membershipParams['contribution'] ?? NULL;
         unset($params['lineItems']);
         $this->_membershipIDs[] = $membership->id;
-        $createdMemberships[$memType] = $membership;
         $count++;
       }
 
@@ -1379,7 +1364,6 @@ DESC limit 1");
         $lineItem[$this->_priceSetId][$id]['entity_table'] = 'civicrm_membership';
 
         $this->_membershipIDs[] = $membership->id;
-        $createdMemberships[$membership->membership_type_id] = $membership;
       }
       $params['lineItems'] = $lineItem;
       if (!empty($formValues['record_contribution'])) {
@@ -1387,11 +1371,10 @@ DESC limit 1");
       }
     }
     if (($this->_action & CRM_Core_Action::UPDATE)) {
-      $this->addStatusMessage($this->getStatusMessageForUpdate($membership, $endDate));
+      $this->addStatusMessage($this->getStatusMessageForUpdate());
     }
     elseif (($this->_action & CRM_Core_Action::ADD)) {
-      $this->addStatusMessage($this->getStatusMessageForCreate($endDate, $createdMemberships,
-        $this->isCreateRecurringContribution(), $calcDates));
+      $this->addStatusMessage($this->getStatusMessageForCreate());
     }
 
     // This would always be true as we always add price set id into both
@@ -1581,17 +1564,15 @@ DESC limit 1");
   /**
    * Get status message for updating membership.
    *
-   * @param CRM_Member_BAO_Membership $membership
-   * @param string $endDate
-   *
    * @return string
+   * @throws \CiviCRM_API3_Exception
    */
-  protected function getStatusMessageForUpdate($membership, $endDate) {
-    // End date can be modified by hooks, so if end date is set then use it.
-    $endDate = ($membership->end_date) ? $membership->end_date : $endDate;
-
+  protected function getStatusMessageForUpdate(): string {
+    foreach ($this->getCreatedMemberships() as $membership) {
+      $endDate = $membership['end_date'] ?? NULL;
+    }
     $statusMsg = ts('Membership for %1 has been updated.', [1 => $this->_memberDisplayName]);
-    if ($endDate && $endDate !== 'null') {
+    if ($endDate) {
       $endDate = CRM_Utils_Date::customFormat($endDate);
       $statusMsg .= ' ' . ts('The membership End Date is %1.', [1 => $endDate]);
     }
@@ -1601,39 +1582,25 @@ DESC limit 1");
   /**
    * Get status message for create action.
    *
-   * @param string $endDate
-   * @param array $createdMemberships
-   * @param bool $isRecur
-   * @param array $calcDates
-   *
    * @return array|string
+   * @throws \CiviCRM_API3_Exception
    */
-  protected function getStatusMessageForCreate($endDate, $createdMemberships,
-                                               $isRecur, $calcDates) {
-    // FIX ME: fix status messages
-
-    $statusMsg = [];
-    foreach ($this->_memTypeSelected as $membershipTypeID) {
-      $statusMsg[$membershipTypeID] = ts('%1 membership for %2 has been added.', [
-        1 => $this->allMembershipTypeDetails[$membershipTypeID]['name'],
+  protected function getStatusMessageForCreate(): string {
+    foreach ($this->getCreatedMemberships() as $membership) {
+      $statusMsg[$membership['membership_type_id']] = ts('%1 membership for %2 has been added.', [
+        1 => $this->allMembershipTypeDetails[$membership['membership_type_id']]['name'],
         2 => $this->_memberDisplayName,
       ]);
 
-      $membership = $createdMemberships[$membershipTypeID];
-      $memEndDate = $membership->end_date ?: $endDate;
-
-      //get the end date from calculated dates.
-      if (!$memEndDate && !$isRecur) {
-        $memEndDate = $calcDates[$membershipTypeID]['end_date'] ?? NULL;
-      }
+      $memEndDate = $membership['end_date'] ?? NULL;
 
-      if ($memEndDate && $memEndDate !== 'null') {
+      if ($memEndDate) {
         $memEndDate = CRM_Utils_Date::formatDateOnlyLong($memEndDate);
-        $statusMsg[$membershipTypeID] .= ' ' . ts('The new membership End Date is %1.', [1 => $memEndDate]);
+        $statusMsg[$membership['membership_type_id']] .= ' ' . ts('The new membership End Date is %1.', [1 => $memEndDate]);
       }
     }
     $statusMsg = implode('<br/>', $statusMsg);
-    return $statusMsg;
+    return $statusMsg ?? '';
   }
 
   /**
@@ -1703,7 +1670,7 @@ DESC limit 1");
       $this->assign('is_pay_later', 0);
       $this->assign('isPrimary', 1);
     }
-    return self::emailReceipt($this, $formValues, $membership);
+    return $this->emailReceipt($this, $formValues, $membership);
   }
 
   /**
@@ -1822,7 +1789,7 @@ DESC limit 1");
     }
     $recurParams['invoice_id'] = $this->getInvoiceID();
     $recurParams['contribution_status_id'] = CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Pending');
-    $recurParams['payment_processor_id'] = $params['payment_processor_id'] ?? NULL;
+    $recurParams['payment_processor_id'] = $this->getPaymentProcessorID();
     $recurParams['is_email_receipt'] = (bool) $this->getSubmittedValue('send_receipt');
     // we need to add a unique trxn_id to avoid a unique key error
     // in paypal IPN we reset this when paypal sends us the real trxn id, CRM-2991
@@ -1893,4 +1860,23 @@ DESC limit 1");
     return $this->_mode && $this->getSubmittedValue('auto_renew');
   }
 
+  /**
+   * Get the payment processor ID.
+   *
+   * @return int
+   */
+  public function getPaymentProcessorID(): int {
+    return (int) ($this->getSubmittedValue('payment_processor_id') ?: $this->_paymentProcessor['id']);
+  }
+
+  /**
+   * Get memberships submitted through the form submission.
+   * @return array
+   *
+   * @throws \CiviCRM_API3_Exception
+   */
+  protected function getCreatedMemberships(): array {
+    return civicrm_api3('Membership', 'get', ['id' => ['IN' => $this->_membershipIDs]])['values'];
+  }
+
 }
index 3f4ea75796eae4f593e116746024d29744d386c8..74a33c52f0ff0a0391c93c0433cc506dc69251a5 100644 (file)
@@ -55,6 +55,16 @@ class CRM_Upgrade_Incremental_php_FiveThirtySeven extends CRM_Upgrade_Incrementa
    * (change the x in the function name):
    */
 
+  /**
+   * Upgrade function.
+   *
+   * @param string $rev
+   */
+  public function upgrade_5_37_alpha1($rev) {
+    $this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev);
+    $this->addTask('core-issue#1845 - Alter Foreign key on civicrm_group to delete when the associated group when the saved search is deleted', 'alterSavedSearchFK');
+  }
+
   //  /**
   //   * Upgrade function.
   //   *
@@ -72,4 +82,16 @@ class CRM_Upgrade_Incremental_php_FiveThirtySeven extends CRM_Upgrade_Incrementa
   //   return TRUE;
   // }
 
+  /**
+   * @param \CRM_Queue_TaskContext $ctx
+   *
+   * @return bool
+   */
+  public static function alterSavedSearchFK(CRM_Queue_TaskContext $ctx) {
+    CRM_Core_BAO_SchemaHandler::safeRemoveFK('civicrm_group', 'FK_civicrm_group_saved_search_id');
+    CRM_Core_DAO::executeQuery('DELETE civicrm_saved_search FROM civicrm_saved_search LEFT JOIN civicrm_group ON civicrm_saved_search.id = civicrm_group.saved_search_id WHERE civicrm_group.id IS NULL AND form_values IS NOT NULL and api_params IS NULL');
+    CRM_Core_DAO::executeQuery('ALTER TABLE civicrm_group ADD CONSTRAINT `FK_civicrm_group_saved_search_id` FOREIGN KEY (`saved_search_id`) REFERENCES `civicrm_saved_search`(`id`) ON DELETE CASCADE', [], TRUE, NULL, FALSE, FALSE);
+    return TRUE;
+  }
+
 }
index d1dfe3112ad2343d830f04d9c99eee163b2db0c4..89a65a6c779d52c687dd1e814ef109ef4a715c71 100644 (file)
@@ -83,7 +83,6 @@ class CRM_Upgrade_Incremental_php_FiveThirtySix extends CRM_Upgrade_Incremental_
       'civicrm_saved_search', 'description', "text DEFAULT NULL");
 
     $this->addTask('core-issue#2422 - Add constraints to civicrm_saved_search', 'taskAddConstraints');
-
   }
 
   /**
index e126a6d5f329d84041f9ba70f62d5118721b031f..6a1ce83351b07dd05a77bbb46d52c70d82f1e487 100644 (file)
@@ -1012,4 +1012,10 @@ abstract class CRM_Utils_System_Base {
     return [];
   }
 
+  /**
+   * Invalidates the cache of dynamic routes and forces a rebuild.
+   */
+  public function invalidateRouteCache() {
+  }
+
 }
index a7bb1aaede5fa4912ca0eafab88f8cc644eb5903..a506c36b9392cd1e375bade2118292d2d245fcf2 100644 (file)
@@ -858,4 +858,14 @@ class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase {
     return \Drupal::entityTypeManager()->getStorage('user')->load($userID);
   }
 
+  /**
+   * Helper function to rebuild the Drupal 8 or 9 dynamic routing cache.
+   * We need to do this after enabling extensions that add routes and it's worth doing when we reset Civi paths.
+   */
+  public function invalidateRouteCache() {
+    if (class_exists('\Drupal') && \Drupal::hasContainer()) {
+      \Drupal::service('router.builder')->rebuild();
+    }
+  }
+
 }
index 8dfc7d6295063084a44c53bbf44cdebf0b814150..01d833e72b829a9a2035e10cd81edab9588c1e33 100644 (file)
@@ -529,4 +529,30 @@ class CRM_Utils_Type {
     return array_combine($types, $types);
   }
 
+  /**
+   * Get all the types that are text-like.
+   *
+   * The returned types would all legitimately be compared to '' by mysql
+   * in a query.
+   *
+   * e.g
+   * WHERE display_name = '' is valid
+   * WHERE id = '' is not and in some mysql configurations and queries
+   * could cause an error.
+   *
+   * @return array
+   */
+  public static function getTextTypes(): array {
+    return [
+      self::T_STRING,
+      self::T_ENUM,
+      self::T_TEXT,
+      self::T_LONGTEXT,
+      self::T_BLOB,
+      self::T_EMAIL,
+      self::T_URL,
+      self::T_MEDIUMBLOB,
+    ];
+  }
+
 }
index 66b8966ade869dd3241bd7c3bfa61c49ea5e8a05..7065c6c2aebc5654ce3cb1955aa5605be11eff27 100644 (file)
@@ -14,6 +14,7 @@ namespace Civi\Api4\Action;
 
 use Civi\API\Exception\NotImplementedException;
 use Civi\Api4\Generic\BasicGetAction;
+use Civi\Api4\Utils\CoreUtil;
 use Civi\Api4\Utils\ReflectionUtils;
 
 /**
@@ -30,7 +31,8 @@ class GetActions extends BasicGetAction {
   protected function getRecords() {
     $this->_actionsToGet = $this->_itemsToGet('name');
 
-    $entityReflection = new \ReflectionClass('\Civi\Api4\\' . $this->_entityName);
+    $className = CoreUtil::getApiClass($this->_entityName);
+    $entityReflection = new \ReflectionClass($className);
     foreach ($entityReflection->getMethods(\ReflectionMethod::IS_STATIC | \ReflectionMethod::IS_PUBLIC) as $method) {
       $actionName = $method->getName();
       if ($actionName != 'permissions' && $actionName != 'getInfo' && $actionName[0] != '_') {
@@ -39,28 +41,30 @@ class GetActions extends BasicGetAction {
     }
     if (!$this->_actionsToGet || count($this->_actionsToGet) > count($this->_actions)) {
       // Search for entity-specific actions in extensions
+      $nameSpace = str_replace('Civi\Api4\\', 'Civi\Api4\Action\\', $className);
       foreach (\CRM_Extension_System::singleton()->getMapper()->getActiveModuleFiles() as $ext) {
         $dir = \CRM_Utils_File::addTrailingSlash(dirname($ext['filePath']));
-        $this->scanDir($dir . 'Civi/Api4/Action/' . $this->_entityName);
+        $this->scanDir($dir, $nameSpace);
       }
       // Search for entity-specific actions in core
-      $this->scanDir(\CRM_Utils_File::addTrailingSlash(__DIR__) . $this->_entityName);
+      global $civicrm_root;
+      $this->scanDir(\CRM_Utils_File::addTrailingSlash($civicrm_root), $nameSpace);
     }
     ksort($this->_actions);
     return $this->_actions;
   }
 
   /**
-   * @param $dir
+   * @param string $dir
+   * @param string $nameSpace
    */
-  private function scanDir($dir) {
+  private function scanDir($dir, $nameSpace) {
+    $dir .= str_replace('\\', '/', $nameSpace);
     if (is_dir($dir)) {
       foreach (glob("$dir/*.php") as $file) {
-        $matches = [];
-        preg_match('/(\w*)\.php$/', $file, $matches);
-        $actionName = array_pop($matches);
-        $actionClass = new \ReflectionClass('\\Civi\\Api4\\Action\\' . $this->_entityName . '\\' . $actionName);
-        if ($actionClass->isInstantiable() && $actionClass->isSubclassOf('\\Civi\\Api4\\Generic\\AbstractAction')) {
+        $actionName = basename($file, '.php');
+        $actionClass = new \ReflectionClass($nameSpace . '\\' . $actionName);
+        if ($actionClass->isInstantiable() && $actionClass->isSubclassOf('\Civi\\Api4\Generic\AbstractAction')) {
           $this->loadAction(lcfirst($actionName));
         }
       }
index 4db822d5f93cd88b753d80a843cda840f4ee1ad6..754d33f387fa361094a60d0bb7acb5dfb10067f8 100644 (file)
@@ -46,7 +46,7 @@ abstract class AbstractEntity {
    * @return \Civi\Api4\Action\GetActions
    */
   public static function getActions($checkPermissions = TRUE) {
-    return (new \Civi\Api4\Action\GetActions(self::getEntityName(), __FUNCTION__))
+    return (new \Civi\Api4\Action\GetActions(static::getEntityName(), __FUNCTION__))
       ->setCheckPermissions($checkPermissions);
   }
 
@@ -109,7 +109,7 @@ abstract class AbstractEntity {
    * @throws NotImplementedException
    */
   public static function __callStatic($action, $args) {
-    $entity = self::getEntityName();
+    $entity = static::getEntityName();
     $nameSpace = str_replace('Civi\Api4\\', 'Civi\Api4\Action\\', static::class);
     // Find class for this action
     $entityAction = "$nameSpace\\" . ucfirst($action);
index b582d294912bfea5060be439c5534dd43bcff896..96122f909ae3c673e8876ea564f0c658a07f8c6f 100644 (file)
@@ -87,7 +87,7 @@ abstract class BasicEntity extends AbstractEntity {
    * @return BasicGetAction
    */
   public static function get($checkPermissions = TRUE) {
-    return (new BasicGetAction(static::class, __FUNCTION__, static::$getter))
+    return (new BasicGetAction(static::getEntityName(), __FUNCTION__, static::$getter))
       ->setCheckPermissions($checkPermissions);
   }
 
@@ -96,7 +96,7 @@ abstract class BasicEntity extends AbstractEntity {
    * @return BasicCreateAction
    */
   public static function create($checkPermissions = TRUE) {
-    return (new BasicCreateAction(static::class, __FUNCTION__, static::$setter))
+    return (new BasicCreateAction(static::getEntityName(), __FUNCTION__, static::$setter))
       ->setCheckPermissions($checkPermissions);
   }
 
@@ -105,7 +105,7 @@ abstract class BasicEntity extends AbstractEntity {
    * @return BasicSaveAction
    */
   public static function save($checkPermissions = TRUE) {
-    return (new BasicSaveAction(static::class, __FUNCTION__, static::$idField, static::$setter))
+    return (new BasicSaveAction(static::getEntityName(), __FUNCTION__, static::$idField, static::$setter))
       ->setCheckPermissions($checkPermissions);
   }
 
@@ -114,7 +114,7 @@ abstract class BasicEntity extends AbstractEntity {
    * @return BasicUpdateAction
    */
   public static function update($checkPermissions = TRUE) {
-    return (new BasicUpdateAction(static::class, __FUNCTION__, static::$idField, static::$setter))
+    return (new BasicUpdateAction(static::getEntityName(), __FUNCTION__, static::$idField, static::$setter))
       ->setCheckPermissions($checkPermissions);
   }
 
@@ -123,7 +123,7 @@ abstract class BasicEntity extends AbstractEntity {
    * @return BasicBatchAction
    */
   public static function delete($checkPermissions = TRUE) {
-    return (new BasicBatchAction(static::class, __FUNCTION__, static::$idField, static::$deleter))
+    return (new BasicBatchAction(static::getEntityName(), __FUNCTION__, static::$idField, static::$deleter))
       ->setCheckPermissions($checkPermissions);
   }
 
@@ -132,7 +132,7 @@ abstract class BasicEntity extends AbstractEntity {
    * @return BasicReplaceAction
    */
   public static function replace($checkPermissions = TRUE) {
-    return (new BasicReplaceAction(static::class, __FUNCTION__))
+    return (new BasicReplaceAction(static::getEntityName(), __FUNCTION__))
       ->setCheckPermissions($checkPermissions);
   }
 
index ad34c1a7538b3a4b19667d9428a03ba380c03406..3bec3919bbdd129a52cdb1535c0c09aeb2af68f3 100644 (file)
@@ -32,7 +32,7 @@ abstract class DAOEntity extends AbstractEntity {
    * @return DAOGetAction
    */
   public static function get($checkPermissions = TRUE) {
-    return (new DAOGetAction(static::class, __FUNCTION__))
+    return (new DAOGetAction(static::getEntityName(), __FUNCTION__))
       ->setCheckPermissions($checkPermissions);
   }
 
@@ -41,7 +41,7 @@ abstract class DAOEntity extends AbstractEntity {
    * @return DAOSaveAction
    */
   public static function save($checkPermissions = TRUE) {
-    return (new DAOSaveAction(static::class, __FUNCTION__))
+    return (new DAOSaveAction(static::getEntityName(), __FUNCTION__))
       ->setCheckPermissions($checkPermissions);
   }
 
@@ -50,7 +50,7 @@ abstract class DAOEntity extends AbstractEntity {
    * @return DAOGetFieldsAction
    */
   public static function getFields($checkPermissions = TRUE) {
-    return (new DAOGetFieldsAction(static::class, __FUNCTION__))
+    return (new DAOGetFieldsAction(static::getEntityName(), __FUNCTION__))
       ->setCheckPermissions($checkPermissions);
   }
 
@@ -59,7 +59,7 @@ abstract class DAOEntity extends AbstractEntity {
    * @return DAOCreateAction
    */
   public static function create($checkPermissions = TRUE) {
-    return (new DAOCreateAction(static::class, __FUNCTION__))
+    return (new DAOCreateAction(static::getEntityName(), __FUNCTION__))
       ->setCheckPermissions($checkPermissions);
   }
 
@@ -68,7 +68,7 @@ abstract class DAOEntity extends AbstractEntity {
    * @return DAOUpdateAction
    */
   public static function update($checkPermissions = TRUE) {
-    return (new DAOUpdateAction(static::class, __FUNCTION__))
+    return (new DAOUpdateAction(static::getEntityName(), __FUNCTION__))
       ->setCheckPermissions($checkPermissions);
   }
 
@@ -77,7 +77,7 @@ abstract class DAOEntity extends AbstractEntity {
    * @return DAODeleteAction
    */
   public static function delete($checkPermissions = TRUE) {
-    return (new DAODeleteAction(static::class, __FUNCTION__))
+    return (new DAODeleteAction(static::getEntityName(), __FUNCTION__))
       ->setCheckPermissions($checkPermissions);
   }
 
@@ -86,7 +86,7 @@ abstract class DAOEntity extends AbstractEntity {
    * @return BasicReplaceAction
    */
   public static function replace($checkPermissions = TRUE) {
-    return (new BasicReplaceAction(static::class, __FUNCTION__))
+    return (new BasicReplaceAction(static::getEntityName(), __FUNCTION__))
       ->setCheckPermissions($checkPermissions);
   }
 
index d5c70622c643fd1d5b788d5a75b9272a092fbd1c..d2f6e5e0deb6e2bc4982ad11bc7c98e340394780 100644 (file)
@@ -34,7 +34,7 @@ class MailSettings extends Generic\DAOEntity {
    * @return \Civi\Api4\Action\MailSettings\TestConnection
    */
   public static function testConnection($checkPermissions = TRUE) {
-    $action = new \Civi\Api4\Action\MailSettings\TestConnection(static::class, __FUNCTION__);
+    $action = new \Civi\Api4\Action\MailSettings\TestConnection(__CLASS__, __FUNCTION__);
     return $action->setCheckPermissions($checkPermissions);
   }
 
index 8009477cc9c620d93f636600142cb9051306347e..2f5ad02cc38313b78e4ae40a6cc31bee9e2c03be 100644 (file)
@@ -35,7 +35,7 @@ class RelationshipCache extends Generic\AbstractEntity {
    * @return Generic\DAOGetAction
    */
   public static function get($checkPermissions = TRUE) {
-    return (new Generic\DAOGetAction(static::class, __FUNCTION__))
+    return (new Generic\DAOGetAction(__CLASS__, __FUNCTION__))
       ->setCheckPermissions($checkPermissions);
   }
 
@@ -44,7 +44,7 @@ class RelationshipCache extends Generic\AbstractEntity {
    * @return Generic\DAOGetFieldsAction
    */
   public static function getFields($checkPermissions = TRUE) {
-    return (new Generic\DAOGetFieldsAction(static::class, __FUNCTION__))
+    return (new Generic\DAOGetFieldsAction(__CLASS__, __FUNCTION__))
       ->setCheckPermissions($checkPermissions);
   }
 
index f1918b7e40c8df2c8dd82978f8b90616f45ff277..72cc5c6fa5b1a08281dc4ba8561de18600ff98c8 100644 (file)
 
     // Format oop params
     function formatOOP(entity, action, params, indent) {
-      var code = '',
+      var info = getEntity(entity),
         newLine = "\n" + _.repeat(' ', indent),
+        code = '\\' + info.class + '::' + action + '(',
         perm = params.checkPermissions === false ? 'FALSE' : '';
       if (entity.substr(0, 7) !== 'Custom_') {
-        code = "\\Civi\\Api4\\" + entity + '::' + action + '(' + perm + ')';
+        code += perm + ')';
       } else {
-        code = "\\Civi\\Api4\\CustomValue::" + action + "('" + entity.substr(7) + "'" + (perm ? ', ' : '') + perm + ")";
+        code += "'" + entity.substr(7) + "'" + (perm ? ', ' : '') + perm + ")";
       }
       _.each(params, function(param, key) {
         var val = '';
index 4847abf604e1445c84bb3ea08253fa12b930c0cc..a2dcb6af553bd8cd6441c47cce322a7482ba64e1 100644 (file)
@@ -22,18 +22,10 @@ abstract class api_v4_AfformTestCase extends \PHPUnit\Framework\TestCase impleme
   /**
    * The setup() method is executed before the test is executed (optional).
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     CRM_Core_Config::singleton()->userPermissionTemp = new CRM_Core_Permission_Temp();
     CRM_Core_Config::singleton()->userPermissionTemp->grant('administer CiviCRM');
   }
 
-  /**
-   * The tearDown() method is executed after the test was executed (optional)
-   * This can be used for cleanup.
-   */
-  public function tearDown() {
-    parent::tearDown();
-  }
-
 }
index 5b77712b89887fd971bf350a6a29031287241713..92b2f605656f0a8d13cca89d47f0d68a5c02f628 100644 (file)
@@ -133,15 +133,17 @@ class Admin {
     // Add in FK fields for implicit joins
     // For example, add a `campaign.title` field to the Contribution entity
     foreach ($schema as &$entity) {
-      foreach (array_reverse($entity['fields'], TRUE) as $index => $field) {
-        if (!empty($field['fk_entity']) && !$field['options'] && !empty($schema[$field['fk_entity']]['label_field'])) {
-          // The original field will get title instead of label since it represents the id (title usually ends in ID but label does not)
-          $entity['fields'][$index]['label'] = $field['title'];
-          // Add the label field from the other entity to this entity's list of fields
-          $newField = \CRM_Utils_Array::findAll($schema[$field['fk_entity']]['fields'], ['name' => $schema[$field['fk_entity']]['label_field']])[0];
-          $newField['name'] = str_replace('_id', '', $field['name']) . '.' . $schema[$field['fk_entity']]['label_field'];
-          $newField['label'] = $field['label'] . ' ' . $newField['label'];
-          array_splice($entity['fields'], $index, 0, [$newField]);
+      if (in_array('DAOEntity', $entity['type'], TRUE) && !in_array('EntityBridge', $entity['type'], TRUE)) {
+        foreach (array_reverse($entity['fields'], TRUE) as $index => $field) {
+          if (!empty($field['fk_entity']) && !$field['options'] && !empty($schema[$field['fk_entity']]['label_field'])) {
+            // The original field will get title instead of label since it represents the id (title usually ends in ID but label does not)
+            $entity['fields'][$index]['label'] = $field['title'];
+            // Add the label field from the other entity to this entity's list of fields
+            $newField = \CRM_Utils_Array::findAll($schema[$field['fk_entity']]['fields'], ['name' => $schema[$field['fk_entity']]['label_field']])[0];
+            $newField['name'] = str_replace('_id', '', $field['name']) . '.' . $schema[$field['fk_entity']]['label_field'];
+            $newField['label'] = $field['label'] . ' ' . $newField['label'];
+            array_splice($entity['fields'], $index, 0, [$newField]);
+          }
         }
       }
     }
index 7aa5b7eb60e1b2b95e3a83f8e03f331a9de08d31..88cdddbe699452fa7805b34b417f96f09ed387c2 100644 (file)
                 'label',
                 'api_entity',
                 'api_params',
+                'created.display_name',
+                'modified.display_name',
+                'created_date',
+                'modified_date',
                 'GROUP_CONCAT(display.name ORDER BY display.id) AS display_name',
                 'GROUP_CONCAT(display.label ORDER BY display.id) AS display_label',
                 'GROUP_CONCAT(display.type:icon ORDER BY display.id) AS display_icon',
index e554164c3f1d91ab5bdbc0481972e045cd17d277..42a36d904eac74e2e3d9cda3d3f6f5413932018d 100644 (file)
@@ -4,6 +4,7 @@
   angular.module('crmSearchAdmin').controller('searchList', function($scope, savedSearches, crmApi4) {
     var ts = $scope.ts = CRM.ts('org.civicrm.search'),
       ctrl = $scope.$ctrl = this;
+    $scope.formatDate = CRM.utils.formatDate;
     this.savedSearches = savedSearches;
     this.afformEnabled = CRM.crmSearchAdmin.afformEnabled;
     this.afformAdminEnabled = CRM.crmSearchAdmin.afformAdminEnabled;
index 427ae1718b075ca1f80d10e345258a1f2025436c..856f4e89a8f2b9922f3eec599394b3f9a7e435e3 100644 (file)
         <th>{{:: ts('Displays') }}</th>
         <th>{{:: ts('Smart Group') }}</th>
         <th ng-if="$ctrl.afformEnabled">{{:: ts('Forms') }}</th>
+        <th>{{:: ts('Created') }}</th>
+        <th>{{:: ts('Last Modified') }}</th>
         <th></th>
       </tr>
     </thead>
     <tbody>
       <tr ng-repeat="search in $ctrl.savedSearches | filter:$ctrl.searchFilter">
-        <td>{{ search.id }}</td>
-        <td>{{ search.label }}</td>
-        <td>{{ $ctrl.entityTitles[search.api_entity] }}</td>
+        <td>{{:: search.id }}</td>
+        <td>{{:: search.label }}</td>
+        <td>{{:: $ctrl.entityTitles[search.api_entity] }}</td>
         <td>
           <div class="btn-group">
             <button type="button" disabled ng-if="!search.display_name" class="btn btn-xs dropdown-toggle btn-primary-outline">
@@ -43,7 +45,7 @@
             </ul>
           </div>
         </td>
-        <td>{{ search.groups.join(', ') }}</td>
+        <td>{{:: search.groups.join(', ') }}</td>
         <td ng-if="::$ctrl.afformEnabled">
           <div class="btn-group">
             <button type="button" ng-click="$ctrl.loadAfforms()" ng-if="search.display_name" class="btn btn-xs dropdown-toggle btn-primary-outline" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
@@ -72,6 +74,8 @@
             </ul>
           </div>
         </td>
+        <td>{{:: ts('%1 by %2', {1: formatDate(search.created_date), 2: search['created.display_name']}) }}</td>
+        <td>{{:: ts('%1 by %2', {1: formatDate(search.created_date), 2: search['modified.display_name']}) }}</td>
         <td class="text-right">
           <a class="btn btn-xs btn-default" href="#/edit/{{:: search.id }}">{{:: ts('Edit') }}</a>
           <a class="btn btn-xs btn-default" href="#/create/{{:: search.api_entity + '?params=' + $ctrl.encode(search.api_params) }}">{{:: ts('Clone') }}</a>
index 0ddd19d6aa1285fd2f7406a7428048f3a1164b0a..5a02515989fda3c5c9fb51207192b13bf6d869e2 100644 (file)
@@ -32,8 +32,6 @@
             <div class="crm-content crm-custom-data crm-contact-reference">
               {', '|implode:$element.contact_ref_links}
             </div>
-          {elseif $element.field_data_type EQ 'Money'}
-            <div class="crm-content crm-custom-data">{$element.field_value|crmMoney}</div>
           {else}
             <div class="crm-content crm-custom-data">{$element.field_value}</div>
           {/if}
diff --git a/templates/CRM/Contact/Page/View/Summary-tab.tpl b/templates/CRM/Contact/Page/View/Summary-tab.tpl
new file mode 100644 (file)
index 0000000..67cf851
--- /dev/null
@@ -0,0 +1,156 @@
+{*
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC. All rights reserved.                        |
+ |                                                                    |
+ | This work is published under the GNU AGPLv3 license with some      |
+ | permitted exceptions and without any warranty. For full license    |
+ | and copyright information, see https://civicrm.org/licensing       |
+ +--------------------------------------------------------------------+
+*}
+{* Summary tab from Contact Summary screen *}
+
+{if (isset($hookContentPlacement) and ($hookContentPlacement neq 3)) or empty($hookContentPlacement)}
+
+  {if !empty($hookContent) and isset($hookContentPlacement) and $hookContentPlacement eq 2}
+    {include file="CRM/Contact/Page/View/SummaryHook.tpl"}
+  {/if}
+
+  <div class="contactTopBar contact_panel">
+    <div class="contactCardLeft">
+      {crmRegion name="contact-basic-info-left"}
+        <div class="crm-summary-contactinfo-block">
+          <div class="crm-summary-block" id="contactinfo-block">
+            {include file="CRM/Contact/Page/Inline/ContactInfo.tpl"}
+          </div>
+        </div>
+      {/crmRegion}
+    </div>
+    <div class="contactCardRight">
+      {crmRegion name="contact-basic-info-right"}
+      {if !empty($imageURL)}
+        <div id="crm-contact-thumbnail">
+          {include file="CRM/Contact/Page/ContactImage.tpl"}
+        </div>
+      {/if}
+        <div class="{if !empty($imageURL)} float-left{/if}">
+          <div class="crm-summary-basic-block crm-summary-block">
+            {include file="CRM/Contact/Page/Inline/Basic.tpl"}
+          </div>
+        </div>
+      {/crmRegion}
+    </div>
+  </div>
+  <div class="contact_details">
+    <div class="contact_panel">
+      <div class="contactCardLeft">
+        {crmRegion name="contact-details-left"}
+          <div >
+            {if $showEmail}
+              <div class="crm-summary-email-block crm-summary-block" id="email-block">
+                {include file="CRM/Contact/Page/Inline/Email.tpl"}
+              </div>
+            {/if}
+            {if $showWebsite}
+              <div class="crm-summary-website-block crm-summary-block" id="website-block">
+                {include file="CRM/Contact/Page/Inline/Website.tpl"}
+              </div>
+            {/if}
+          </div>
+        {/crmRegion}
+      </div><!-- #contactCardLeft -->
+
+      <div class="contactCardRight">
+        {crmRegion name="contact-details-right"}
+          <div>
+            {if $showPhone}
+              <div class="crm-summary-phone-block crm-summary-block" id="phone-block">
+                {include file="CRM/Contact/Page/Inline/Phone.tpl"}
+              </div>
+            {/if}
+            {if $showIM}
+              <div class="crm-summary-im-block crm-summary-block" id="im-block">
+                {include file="CRM/Contact/Page/Inline/IM.tpl"}
+              </div>
+            {/if}
+            {if $showOpenID}
+              <div class="crm-summary-openid-block crm-summary-block" id="openid-block">
+                {include file="CRM/Contact/Page/Inline/OpenID.tpl"}
+              </div>
+            {/if}
+          </div>
+        {/crmRegion}
+      </div><!-- #contactCardRight -->
+
+      <div class="clear"></div>
+    </div><!-- #contact_panel -->
+    {if $showAddress}
+      <div class="contact_panel">
+        {crmRegion name="contact-addresses"}
+        {assign var='locationIndex' value=1}
+        {if $address}
+          {foreach from=$address item=add key=locationIndex}
+            <div class="{if $locationIndex is odd}contactCardLeft{else}contactCardRight{/if} crm-address_{$locationIndex} crm-address-block crm-summary-block">
+              {include file="CRM/Contact/Page/Inline/Address.tpl"}
+            </div>
+          {/foreach}
+          {assign var='locationIndex' value=$locationIndex+1}
+        {/if}
+          {* add new link *}
+        {if $permission EQ 'edit'}
+          {assign var='add' value=0}
+          <div class="{if $locationIndex is odd}contactCardLeft{else}contactCardRight{/if} crm-address-block crm-summary-block">
+            {include file="CRM/Contact/Page/Inline/Address.tpl"}
+          </div>
+        {/if}
+        {/crmRegion}
+      </div> <!-- end of contact panel -->
+    {/if}
+    <div class="contact_panel">
+      {if $showCommunicationPreferences}
+        <div class="contactCardLeft">
+          {crmRegion name="contact-comm-pref"}
+            <div class="crm-summary-comm-pref-block">
+              <div class="crm-summary-block" id="communication-pref-block" >
+                {include file="CRM/Contact/Page/Inline/CommunicationPreferences.tpl"}
+              </div>
+            </div>
+          {/crmRegion}
+        </div> <!-- contactCardLeft -->
+      {/if}
+      {if $contact_type eq 'Individual' AND $showDemographics}
+        <div class="contactCardRight">
+          {crmRegion name="contact-demographic"}
+            <div class="crm-summary-demographic-block">
+              <div class="crm-summary-block" id="demographic-block">
+                {include file="CRM/Contact/Page/Inline/Demographics.tpl"}
+              </div>
+            </div>
+          {/crmRegion}
+        </div> <!-- contactCardRight -->
+      {/if}
+      <div class="clear"></div>
+      <div class="separator"></div>
+    </div> <!-- contact panel -->
+  </div><!--contact_details-->
+
+  {if $showCustomData}
+    <div id="customFields">
+      <div class="contact_panel">
+        <div class="contactCardLeft">
+          {include file="CRM/Contact/Page/View/CustomDataView.tpl" side='1'}
+        </div><!--contactCardLeft-->
+        <div class="contactCardRight">
+          {include file="CRM/Contact/Page/View/CustomDataView.tpl" side='0'}
+        </div>
+
+        <div class="clear"></div>
+      </div>
+    </div>
+  {/if}
+
+  {if !empty($hookContent) and isset($hookContentPlacement) and $hookContentPlacement eq 1}
+    {include file="CRM/Contact/Page/View/SummaryHook.tpl"}
+  {/if}
+{else}
+  {include file="CRM/Contact/Page/View/SummaryHook.tpl"}
+{/if}
index bad21b98b2204fae74bf6e9be0858e378e12a431..1fbd228aa2dcd58ad60e31868dceba84783dd6b5 100644 (file)
   <div class="crm-block crm-content-block crm-contact-page crm-inline-edit-container">
     <div id="mainTabContainer">
       <ul class="crm-contact-tabs-list">
-        {foreach from=$allTabs key=tabName item=tabValue}
+        {foreach from=$allTabs item=tabValue}
           <li id="tab_{$tabValue.id}" class="crm-tab-button ui-corner-all crm-count-{$tabValue.count}{if isset($tabValue.class)} {$tabValue.class}{/if}">
-            <a href="{$tabValue.url}" title="{$tabValue.title|escape}">
+            <a href="{if !empty($tabValue.template)}#contact-{$tabValue.id}{else}{$tabValue.url}{/if}" title="{$tabValue.title|escape}">
               <i class="{if $tabValue.icon}{$tabValue.icon}{else}crm-i fa-puzzle-piece{/if}" aria-hidden="true"></i>
               <span>{$tabValue.title}</span>
               {if empty($tabValue.hideCount)}<em>{$tabValue.count}</em>{/if}
         {/foreach}
       </ul>
 
-      <div id="contact-summary" class="ui-tabs-panel ui-widget-content ui-corner-bottom">
-        {if (isset($hookContentPlacement) and ($hookContentPlacement neq 3)) or empty($hookContentPlacement)}
-
-          {if !empty($hookContent) and isset($hookContentPlacement) and $hookContentPlacement eq 2}
-            {include file="CRM/Contact/Page/View/SummaryHook.tpl"}
-          {/if}
-
-          <div class="contactTopBar contact_panel">
-            <div class="contactCardLeft">
-              {crmRegion name="contact-basic-info-left"}
-                <div class="crm-summary-contactinfo-block">
-                  <div class="crm-summary-block" id="contactinfo-block">
-                    {include file="CRM/Contact/Page/Inline/ContactInfo.tpl"}
-                  </div>
-                </div>
-              {/crmRegion}
-            </div> <!-- end of left side -->
-            <div class="contactCardRight">
-              {crmRegion name="contact-basic-info-right"}
-              {if !empty($imageURL)}
-                <div id="crm-contact-thumbnail">
-                  {include file="CRM/Contact/Page/ContactImage.tpl"}
-                </div>
-              {/if}
-                <div class="{if !empty($imageURL)} float-left{/if}">
-                  <div class="crm-summary-basic-block crm-summary-block">
-                    {include file="CRM/Contact/Page/Inline/Basic.tpl"}
-                  </div>
-                </div>
-              {/crmRegion}
-            </div>
-            <!-- end of right side -->
-        </div>
-        <div class="contact_details">
-          <div class="contact_panel">
-            <div class="contactCardLeft">
-              {crmRegion name="contact-details-left"}
-                <div >
-                  {if $showEmail}
-                    <div class="crm-summary-email-block crm-summary-block" id="email-block">
-                      {include file="CRM/Contact/Page/Inline/Email.tpl"}
-                    </div>
-                  {/if}
-                  {if $showWebsite}
-                    <div class="crm-summary-website-block crm-summary-block" id="website-block">
-                      {include file="CRM/Contact/Page/Inline/Website.tpl"}
-                    </div>
-                  {/if}
-                </div>
-              {/crmRegion}
-            </div><!-- #contactCardLeft -->
-
-            <div class="contactCardRight">
-              {crmRegion name="contact-details-right"}
-                <div>
-                  {if $showPhone}
-                    <div class="crm-summary-phone-block crm-summary-block" id="phone-block">
-                      {include file="CRM/Contact/Page/Inline/Phone.tpl"}
-                    </div>
-                  {/if}
-                  {if $showIM}
-                    <div class="crm-summary-im-block crm-summary-block" id="im-block">
-                      {include file="CRM/Contact/Page/Inline/IM.tpl"}
-                    </div>
-                  {/if}
-                  {if $showOpenID}
-                    <div class="crm-summary-openid-block crm-summary-block" id="openid-block">
-                      {include file="CRM/Contact/Page/Inline/OpenID.tpl"}
-                    </div>
-                  {/if}
-                </div>
-              {/crmRegion}
-            </div><!-- #contactCardRight -->
-
-            <div class="clear"></div>
-          </div><!-- #contact_panel -->
-          {if $showAddress}
-            <div class="contact_panel">
-              {crmRegion name="contact-addresses"}
-              {assign var='locationIndex' value=1}
-              {if $address}
-                {foreach from=$address item=add key=locationIndex}
-                  <div class="{if $locationIndex is odd}contactCardLeft{else}contactCardRight{/if} crm-address_{$locationIndex} crm-address-block crm-summary-block">
-                    {include file="CRM/Contact/Page/Inline/Address.tpl"}
-                  </div>
-                {/foreach}
-                {assign var='locationIndex' value=$locationIndex+1}
-              {/if}
-              {* add new link *}
-              {if $permission EQ 'edit'}
-                {assign var='add' value=0}
-                <div class="{if $locationIndex is odd}contactCardLeft{else}contactCardRight{/if} crm-address-block crm-summary-block">
-                  {include file="CRM/Contact/Page/Inline/Address.tpl"}
-                </div>
-              {/if}
-              {/crmRegion}
-              </div> <!-- end of contact panel -->
-            {/if}
-            <div class="contact_panel">
-              {if $showCommunicationPreferences}
-                <div class="contactCardLeft">
-                  {crmRegion name="contact-comm-pref"}
-                  <div class="crm-summary-comm-pref-block">
-                    <div class="crm-summary-block" id="communication-pref-block" >
-                      {include file="CRM/Contact/Page/Inline/CommunicationPreferences.tpl"}
-                    </div>
-                  </div>
-                  {/crmRegion}
-                </div> <!-- contactCardLeft -->
-              {/if}
-              {if $contact_type eq 'Individual' AND $showDemographics}
-                <div class="contactCardRight">
-                  {crmRegion name="contact-demographic"}
-                  <div class="crm-summary-demographic-block">
-                    <div class="crm-summary-block" id="demographic-block">
-                      {include file="CRM/Contact/Page/Inline/Demographics.tpl"}
-                    </div>
-                  </div>
-                  {/crmRegion}
-                </div> <!-- contactCardRight -->
-              {/if}
-              <div class="clear"></div>
-                <div class="separator"></div>
-              </div> <!-- contact panel -->
-            </div><!--contact_details-->
-
-            {if $showCustomData}
-              <div id="customFields">
-                <div class="contact_panel">
-                  <div class="contactCardLeft">
-                    {include file="CRM/Contact/Page/View/CustomDataView.tpl" side='1'}
-                  </div><!--contactCardLeft-->
-                  <div class="contactCardRight">
-                    {include file="CRM/Contact/Page/View/CustomDataView.tpl" side='0'}
-                  </div>
-
-                  <div class="clear"></div>
-                </div>
-              </div>
-            {/if}
-
-            {if !empty($hookContent) and isset($hookContentPlacement) and $hookContentPlacement eq 1}
-              {include file="CRM/Contact/Page/View/SummaryHook.tpl"}
-            {/if}
-          {else}
-             {include file="CRM/Contact/Page/View/SummaryHook.tpl"}
-          {/if}
-        </div>
-      <div class="clear"></div>
+      {foreach from=$allTabs item=tabValue}
+        {if !empty($tabValue.template)}
+          <div id="contact-{$tabValue.id}">
+            {include file=$tabValue.template}
+          </div>
+        {/if}
+      {/foreach}
     </div>
     <div class="clear"></div>
-  </div><!-- /.crm-content-block -->
+  </div>
 {/if}
 
 {* CRM-10560 *}
index 1345f31f9a2a3cc1a1058f9a1899414a67d240ce..c2e54d9b8aadd6256a875672004bc6e72f3da7d6 100644 (file)
@@ -28,7 +28,7 @@
     </ul>
       {foreach from=$tabHeader key=tabName item=tabValue}
         {if !empty($tabValue.template)}
-          <div id="#panel_{$tabName}">
+          <div id="panel_{$tabName}">
             {include file=$tabValue.template}
           </div>
         {/if}
index c435ffca4cb9258f7d2ba5696a920939ab40a04b..73bd29a9d6ac0dc3a249c1aec95f38cba88c68f3 100644 (file)
@@ -13,7 +13,7 @@ class CRM_ACL_ListTest extends CiviUnitTestCase {
   /**
    * Set up function.
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     // $this->quickCleanup(array('civicrm_acl_contact_cache'), TRUE);
     $this->useTransaction(TRUE);
index 1ea6c11d85258d17cb18b6ca8ff52978a1ac3d19..66607cbd512a3defa9bb28a290a87f5a4520de37 100644 (file)
  */
 class CRM_Activity_BAO_ActivityAssignmentTest extends CiviUnitTestCase {
 
-  /**
-   * Sets up the fixture, for example, opens a network connection.
-   * This method is called before a test is executed.
-   */
-  protected function setUp() {
-    parent::setUp();
-  }
-
-  /**
-   * Tears down the fixture, for example, closes a network connection.
-   * This method is called after a test is executed.
-   */
-  protected function tearDown() {
-  }
-
   /**
    *  Pass zero as an id and make sure no Assignees are retrieved.
    */
index 72cdc1b576d3812a5acf189eb6a4217e949c2bb6..fb504ac9a5457fa15713ef1128d80f34b8bdd652 100644 (file)
  */
 class CRM_Activity_BAO_ActivityTargetTest extends CiviUnitTestCase {
 
-  /**
-   * Sets up the fixture, for example, opens a network connection.
-   * This method is called before a test is executed.
-   */
-  protected function setUp() {
-    parent::setUp();
-  }
-
-  /**
-   * Tears down the fixture, for example, closes a network connection.
-   *
-   * This method is called after a test is executed.
-   */
-  protected function tearDown() {
-  }
-
   public function testRetrieveTargetIdsByActivityIdZeroID() {
     $this->activityCreate();
     $target = CRM_Activity_BAO_ActivityTarget::retrieveTargetIdsByActivityId(0);
index 63d299314d84e7005ebe1d008cd9868828444d5f..6e0a62a6abc7348842a90e18eea3ed8dfb5cd5ee 100644 (file)
@@ -17,7 +17,7 @@ class CRM_Activity_BAO_ActivityTest extends CiviUnitTestCase {
    *
    * @throws \CiviCRM_API3_Exception
    */
-  public function setUp() {
+  public function setUp():void {
     parent::setUp();
     $this->prepareForACLs();
     CRM_Core_Config::singleton()->userPermissionClass->permissions = ['view all contacts', 'access CiviCRM'];
@@ -30,7 +30,7 @@ class CRM_Activity_BAO_ActivityTest extends CiviUnitTestCase {
    * @throws \CRM_Core_Exception
    * @throws \CiviCRM_API3_Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $tablesToTruncate = [
       'civicrm_activity',
       'civicrm_activity_contact',
index 8e603a500dc20ad1abe417d8ae9b9ae65579ab14..23969a1216c9b61dbcbc1bc27dd520f457678eb9 100644 (file)
@@ -8,7 +8,7 @@ use Civi\Test\Invasive;
  */
 class CRM_Activity_Form_ActivityTest extends CiviUnitTestCase {
 
-  public function setUp() {
+  public function setUp():void {
     parent::setUp();
     $this->assignee1 = $this->individualCreate([
       'first_name' => 'testassignee1',
index 2c7d4faa3224807f5da36548d0b3710ae8f57aa5..324ce667d923183cba4481fbc7843e410d4fb17e 100644 (file)
@@ -6,7 +6,7 @@
  */
 class CRM_Activity_Form_SearchTest extends CiviUnitTestCase {
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->individualID = $this->individualCreate();
     $this->contributionCreate([
@@ -15,7 +15,7 @@ class CRM_Activity_Form_SearchTest extends CiviUnitTestCase {
     ]);
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     $tablesToTruncate = [
       'civicrm_activity',
       'civicrm_activity_contact',
index f9e9f7506f983c6e7e2080f5a91cf8f427898932..0864cc9fbd0090160bf7364559ff698da923d08c 100644 (file)
@@ -5,7 +5,7 @@
  */
 class CRM_Activity_Page_AJAXTest extends CiviUnitTestCase {
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
 
     $this->loadAllFixtures();
index 0bda3569ccab07f0892184510770f48aec08dbfe..c3fa203b0fd0b9500492c3d3171e83ae405d9e83 100644 (file)
@@ -36,7 +36,7 @@ class CRM_Batch_BAO_BatchTest extends CiviUnitTestCase {
    *
    * @throws \CRM_Core_Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     parent::tearDown();
     $this->quickCleanup(['civicrm_batch']);
   }
index 3d9dbbcb3f4cbd3e52d5b6f1bbdec18611b2fb9e..8dc8ee08b174851fe87bdc41077a666907b62a32 100644 (file)
@@ -75,7 +75,7 @@ class CRM_Batch_Form_EntryTest extends CiviUnitTestCase {
    */
   protected $_contactID4 = NULL;
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
 
     $params = [
@@ -148,7 +148,7 @@ class CRM_Batch_Form_EntryTest extends CiviUnitTestCase {
    * Tears down the fixture, for example, closes a network connection.
    * This method is called after a test is executed.
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanUpFinancialEntities();
     $this->relationshipTypeDelete($this->_relationshipTypeId);
     if ($this->callAPISuccessGetCount('membership', ['id' => $this->_membershipTypeID])) {
index f2af4b77e76ed55264a21bbe3e915c4cb2acd01d..43b42d3d98507a96b59067926527cfaa14afbf9c 100644 (file)
@@ -6,7 +6,7 @@
  */
 class CRM_Case_BAO_CaseTest extends CiviUnitTestCase {
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
 
     $this->tablesToTruncate = [
@@ -56,7 +56,7 @@ class CRM_Case_BAO_CaseTest extends CiviUnitTestCase {
     }
   }
 
-  protected function tearDown() {
+  protected function tearDown(): void {
     parent::tearDown();
     $this->quickCleanup($this->tablesToTruncate, TRUE);
   }
index 493094e2044bd9e16d44bb7ebffddb4a46158359..e77dbda7d46672c2752af96852cce7ac6f424539 100644 (file)
@@ -7,12 +7,12 @@
  */
 class CRM_Case_BAO_CaseTypeForkTest extends CiviCaseTestCase {
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     CRM_Core_ManagedEntities::singleton(TRUE)->reconcile();
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     parent::tearDown();
     CRM_Core_ManagedEntities::singleton(TRUE)->reconcile();
   }
index 949964169388eda48461bff7e71e04df400d765c..1e276558ef381f35a44df945642364fd1906459c 100644 (file)
@@ -9,7 +9,7 @@ class CRM_Case_Form_CustomDataTest extends CiviCaseTestCase {
 
   protected $custom_group;
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->custom_group = $this->customGroupCreate(['extends' => 'Case']);
     $this->custom_group = $this->custom_group['values'][$this->custom_group['id']];
index 42c499d2aa5ffc0edb71177f8986e3f078d9cdbd..2266f1b3b1562730ff62a13c944ef5f0300d9f1a 100644 (file)
@@ -7,7 +7,7 @@ require_once 'CiviTest/CiviCaseTestCase.php';
  */
 class CRM_Case_Form_SearchTest extends CiviCaseTestCase {
 
-  public function setUp() {
+  public function setUp():void {
     parent::setUp();
     $this->quickCleanup(['civicrm_case_contact', 'civicrm_case', 'civicrm_contact']);
   }
index def111e16a8fb2392914486c08dddce1325e6eaa..f16b697e439e2db219537de3492ea1f29848a566 100644 (file)
@@ -7,7 +7,7 @@ require_once 'CiviTest/CiviCaseTestCase.php';
  */
 class CRM_Case_XMLProcessor_ProcessTest extends CiviCaseTestCase {
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
 
     $this->defaultAssigneeOptionsValues = [];
@@ -21,7 +21,7 @@ class CRM_Case_XMLProcessor_ProcessTest extends CiviCaseTestCase {
     $this->process = new CRM_Case_XMLProcessor_Process();
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     $this->deleteMoreRelationshipTypes();
 
     parent::tearDown();
index d524eecb495f17a92498f30c5d2730674b07c11d..acc3bcad98f35e6a85a72ae255f7a622c36a60d5 100644 (file)
@@ -7,7 +7,7 @@ require_once 'CiviTest/CiviCaseTestCase.php';
  */
 class CRM_Case_XMLProcessor_ReportTest extends CiviCaseTestCase {
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
 
     $this->simplifyCaseTypeDefinition();
@@ -15,7 +15,7 @@ class CRM_Case_XMLProcessor_ReportTest extends CiviCaseTestCase {
     $this->report = new CRM_Case_XMLProcessor_Report();
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     parent::tearDown();
   }
 
index 5a12916bd4c8dbe1934e1b21c988fbc42defc270..8a87b5f009038029d4bc6f1a82ba025d6ab785cb 100644 (file)
@@ -7,7 +7,7 @@ require_once 'CiviTest/CiviCaseTestCase.php';
  */
 class CRM_Case_XMLProcessorTest extends CiviCaseTestCase {
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
 
     $this->processor = new CRM_Case_XMLProcessor();
index fe6e4c5e3a927a5482a784cf65a87f08a7308241..9cf37e091e8458fff371faa25e04468c68093aa6 100644 (file)
@@ -7,7 +7,7 @@
 class CRM_Case_XMLRepositoryTest extends CiviUnitTestCase {
   protected $fixtures = [];
 
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     $this->fixtures['CaseTypeWithSingleActivityType'] = '
 <CaseType>
index 9b2e244a22a913df4bc0a72decf75c16efa6f749..78e3bdb3b52f383cf05c38e0e8fa7930766c1744 100644 (file)
@@ -52,7 +52,7 @@ class CRM_Contact_BAO_ActivitySearchTest extends CiviUnitTestCase {
    * Connect to the database, truncate the tables that will be used
    * and redirect stdin to a temporary file
    */
-  public function setUp() {
+  public function setUp(): void {
     // Connect to the database
     parent::setUp();
 
@@ -85,7 +85,7 @@ class CRM_Contact_BAO_ActivitySearchTest extends CiviUnitTestCase {
    *
    * This method is called after a test is executed.
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $tablesToTruncate = [
       'civicrm_contact',
       'civicrm_activity',
index 84689e5dcd7b843e52a26edea246769f764b4624..aa307e7b6181d3865d8f7640b73dcd23c9b7be68 100644 (file)
@@ -6,13 +6,6 @@
  */
 class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase {
 
-  /**
-   * Set up function.
-   */
-  public function setUp() {
-    parent::setUp();
-  }
-
   /**
    * Test case for add( ).
    *
index c22ace62419afc387767efc595d1eae2144a01e0..ead6037968751060b3c19102c7857eac05dfbfbc 100644 (file)
@@ -6,7 +6,7 @@
  */
 class CRM_Contact_BAO_ContactType_ContactSearchTest extends CiviUnitTestCase {
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $students = 'indivi_student' . substr(sha1(rand()), 0, 7);
     $params = [
index a98d9343ad92de1b662c9093ca9f1c4823fc4072..64a28032a5e9ae154788f12ee5a7255e20106fa0 100644 (file)
@@ -6,7 +6,7 @@
  */
 class CRM_Contact_BAO_ContactType_ContactTest extends CiviUnitTestCase {
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
 
     $params = [
@@ -50,7 +50,7 @@ class CRM_Contact_BAO_ContactType_ContactTest extends CiviUnitTestCase {
     $this->team = $params['name'];
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanup(['civicrm_contact']);
     $query = "
 DELETE FROM civicrm_contact_type
index e726e82524b4edbf93750c1448e2ca21881c802f..9adee0c3b4320f59d44d4d49ab11f423145f8839 100644 (file)
@@ -7,7 +7,7 @@ use Civi\Api4\ContactType;
  */
 class CRM_Contact_BAO_ContactType_ContactTypeTest extends CiviUnitTestCase {
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $params = [
       'label' => 'sub1_individual',
@@ -51,7 +51,7 @@ class CRM_Contact_BAO_ContactType_ContactTypeTest extends CiviUnitTestCase {
    * @throws \API_Exception
    * @throws \Civi\API\Exception\UnauthorizedException
    */
-  public function tearDown() {
+  public function tearDown(): void {
     parent::tearDown();
     ContactType::delete()->addWhere('id', 'IN', $this->ids['ContactType'])->execute();
   }
index c7cf9da084db54dd6c436339990b70ab425d42db..8d1ce0af6d9b1aae097949ccc6f1df08a0c604ff 100644 (file)
@@ -6,7 +6,7 @@
  */
 class CRM_Contact_BAO_ContactType_RelationshipTest extends CiviUnitTestCase {
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
 
     //create contact subtypes
@@ -78,7 +78,7 @@ class CRM_Contact_BAO_ContactType_RelationshipTest extends CiviUnitTestCase {
     $this->organization_sponsor = $this->organizationCreate($params);
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanup(['civicrm_contact']);
 
     $query = "
index b15dcf950b448e3fcb4835124766d5dbfda5d729..a0d06a8d263aae7e62208b7bb456b22c9f05da97 100644 (file)
@@ -245,22 +245,12 @@ class CRM_Contact_BAO_GroupContactCacheTest extends CiviUnitTestCase {
    */
   private $_testObjects;
 
-  /**
-   * Sets up the fixture, for example, opens a network connection.
-   *
-   * This method is called before a test is executed.
-   */
-  protected function setUp() {
-    $this->_testObjects = [];
-    parent::setUp();
-  }
-
   /**
    * Tears down the fixture, for example, closes a network connection.
    *
    * This method is called after a test is executed.
    */
-  protected function tearDown() {
+  protected function tearDown(): void {
     parent::tearDown();
     $this->deleteTestObjects();
   }
index c9b4ec62abff349dbc931909054526dc5ec8d9a2..8047ad50127015e6a094ff415184589f8783fb8c 100644 (file)
  */
 class CRM_Contact_BAO_GroupContactTest extends CiviUnitTestCase {
 
-  /**
-   * Sets up the fixture, for example, opens a network connection.
-   * This method is called before a test is executed.
-   */
-  protected function setUp() {
-    parent::setUp();
-  }
-
-  /**
-   * Tears down the fixture, for example, closes a network connection.
-   *
-   * This method is called after a test is executed.
-   */
-  protected function tearDown() {
-  }
-
   /**
    * Test case for add( ).
    */
index ebd2b6cff3590bf85a8d441c0a64efcd71d1cef0..12a30dd15a08d2db86c7c5f7618907fd302f8981 100644 (file)
  */
 class CRM_Contact_BAO_GroupTest extends CiviUnitTestCase {
 
-  /**
-   * Sets up the fixture, for example, opens a network connection.
-   *
-   * This method is called before a test is executed.
-   */
-  protected function setUp() {
-    parent::setUp();
-  }
-
   /**
    * Tears down the fixture, for example, closes a network connection.
    *
    * This method is called after a test is executed.
    */
-  protected function tearDown() {
+  protected function tearDown(): void {
     $this->quickCleanup(['civicrm_mapping_field', 'civicrm_mapping', 'civicrm_group', 'civicrm_saved_search']);
   }
 
index 85ded73c22224bad350472917216db7ddd93b4a3..03dd50e4ef67e151816f9d0ee1598f8222628927 100644 (file)
@@ -17,16 +17,12 @@ class CRM_Contact_BAO_QueryTest extends CiviUnitTestCase {
     return new CRM_Contact_BAO_QueryTestDataProvider();
   }
 
-  public function setUp() {
-    parent::setUp();
-  }
-
   /**
    * Clean up after test.
    *
    * @throws \Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanUpFinancialEntities();
     $tablesToTruncate = [
       'civicrm_group_contact',
index 67fd78535ed8468fdf021ea5b9ce04807f915fda..44cd3c53ee090a84f1564a77e35d3ae4f48ded5e 100644 (file)
@@ -17,7 +17,7 @@
  */
 class CRM_Contact_BAO_RelationshipCacheTest extends CiviUnitTestCase {
 
-  protected function setUp() {
+  protected function setUp(): void {
     $this->useTransaction(TRUE);
     parent::setUp();
   }
index 258a366195c522625fe0773c6574e0c42d277bdf..a78e350c5b7e5181e6ef818edeef028d6d640103 100644 (file)
  */
 class CRM_Contact_BAO_RelationshipTest extends CiviUnitTestCase {
 
-  /**
-   * Sets up the fixture, for example, opens a network connection.
-   *
-   * This method is called before a test is executed.
-   */
-  protected function setUp() {
-    parent::setUp();
-  }
-
   /**
    * Tears down the fixture, for example, closes a network connection.
    *
@@ -33,7 +24,7 @@ class CRM_Contact_BAO_RelationshipTest extends CiviUnitTestCase {
    *
    * @throws \CRM_Core_Exception
    */
-  protected function tearDown() {
+  protected function tearDown(): void {
     $this->quickCleanup([
       'civicrm_relationship_type',
       'civicrm_relationship',
index e2dc8229b21a5b8aade0c26718e4c1330bab8c3b..82506da86eec49eb077755f4e9954e158cf27aad 100644 (file)
@@ -33,7 +33,7 @@ class CRM_Contact_BAO_SavedSearchTest extends CiviUnitTestCase {
    *
    * This method is called after a test is executed.
    */
-  protected function tearDown() {
+  protected function tearDown(): void {
     if (!empty($this->ids['CustomField'])) {
       foreach ($this->ids['CustomField'] as $type => $id) {
         $field = civicrm_api3('CustomField', 'getsingle', ['id' => $id]);
index e9b66a8e8107b337f05dc86b44b02d51577b5c2e..8115a52e06f465b538d5d88b9f720ff60e37bfe0 100644 (file)
@@ -73,13 +73,6 @@ class CRM_Contact_Form_Search_Custom_GroupTest extends CiviUnitTestCase {
     return new CRM_Contact_Form_Search_Custom_GroupTestDataProvider();
   }
 
-  public function setUp() {
-    parent::setUp();
-  }
-
-  public function tearDown() {
-  }
-
   /**
    *  Test CRM_Contact_Form_Search_Custom_Group::count()
    * @dataProvider dataProvider
index 4744b9d713dc9826b979f872b1b7c7cf253880eb..95b8b0313b2f2a27e9cf36e0d71d8c28439cb42b 100644 (file)
  */
 class CRM_Contact_Form_Search_Custom_PriceSetTest extends CiviUnitTestCase {
 
-  public function setUp() {
-    parent::setUp();
-  }
-
-  public function tearDown() {
-  }
-
   public function testRunSearch() {
     $order = $this->callAPISuccess('Order', 'create', $this->getParticipantOrderParams());
     $this->callAPISuccess('Payment', 'create', [
index db659b36c726065d07325bb82c8be24356217358..4398172b62b15a48b50364a258e6b0678258499d 100644 (file)
@@ -51,13 +51,6 @@ class CRM_Contact_Form_Search_Custom_SampleTest extends CiviUnitTestCase {
     return new CRM_Contact_Form_Search_Custom_SampleTestDataProvider();
   }
 
-  public function setUp() {
-    parent::setUp();
-  }
-
-  public function tearDown() {
-  }
-
   /**
    *  Test CRM_Contact_Form_Search_Custom_Sample::count()
    * @dataProvider dataProvider
index 35d87903a52b7782a2240184234b2520e7089ff1..1dca40edfa9c89cc942f7c946a6cf56e086581d0 100644 (file)
@@ -30,7 +30,7 @@ class CRM_Contact_Form_Task_DeleteTest extends CiviUnitTestCase {
     ]);
   }
 
-  protected function tearDown() {
+  protected function tearDown(): void {
     $this->quickCleanup([
       'civicrm_contact',
     ]);
index f717c39cb961c63b1e720c02df8934ae65a50105..1533229d38e7bf20d0fbb48241a694459897b441 100644 (file)
@@ -39,7 +39,7 @@ class CRM_Contact_Form_Task_EmailCommonTest extends CiviUnitTestCase {
    *
    * Make sure the  setting is returned to 'stock'.
    */
-  public function tearDown() {
+  public function tearDown(): void {
     Civi::settings()->set('allow_mail_from_logged_in_contact', 0);
     parent::tearDown();
   }
index e07f17c5d095d01fbda47431a06de4f95276d439..414fc6bf7bf91c8d53553469013f3aca81aa6de3 100644 (file)
@@ -28,7 +28,7 @@ class CRM_Contact_Form_Task_PrintMailingLabelTest extends CiviUnitTestCase {
   /**
    * Clean up after test.
    */
-  protected function tearDown() {
+  protected function tearDown(): void {
     unset($this->_contactIds);
     parent::tearDown();
   }
index 07a2e21d205b277219e0d6fd2c8baa242ea77fe5..1378e4f6bd0a33a264a5fff91bf6b55ee7afc374 100644 (file)
@@ -42,7 +42,7 @@ class CRM_Contact_Import_Parser_ContactTest extends CiviUnitTestCase {
    *
    * @throws \CRM_Core_Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanup(['civicrm_address', 'civicrm_phone', 'civicrm_email'], TRUE);
     parent::tearDown();
   }
index be18ecdf30a4a8c4fc7a31cc0dbfffaf73a7ccef..e7e700ac228fea8b2d34750450a339ec46f6731a 100644 (file)
@@ -20,7 +20,7 @@ class CRM_Contact_Page_AjaxTest extends CiviUnitTestCase {
     $this->originalRequest = $_REQUEST;
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     $_REQUEST = $this->originalRequest;
     parent::tearDown();
   }
index f629590c7a5bd818c4156d63782d5ae518f6fdc1..537a4ed163182c05c1c83aa5859fd2455c33c65e 100644 (file)
@@ -30,7 +30,7 @@ class CRM_Contact_Page_DedupeExceptionTest extends CiviUnitTestCase {
    *
    * This method is called after a test is executed.
    */
-  protected function tearDown() {
+  protected function tearDown(): void {
     parent::tearDown();
   }
 
index c60d2c6a08f506945a3e90f70703c4fd0f6cc3cb..3ce4e7ee1a47a5aa5712d2ca5196a962f89e0a1b 100644 (file)
@@ -31,7 +31,7 @@ class CRM_Contact_Page_View_NoteTest extends CiviUnitTestCase {
    *
    * This method is called after a test is executed.
    */
-  protected function tearDown() {
+  protected function tearDown(): void {
     parent::tearDown();
   }
 
index 71d5481acb17b205de605406c4f2a6c02128c75f..dc5e8260fdcce24c17c372024c261b41612ca7cc 100644 (file)
@@ -45,7 +45,7 @@ class CRM_Contact_Page_View_UserDashBoardTest extends CiviUnitTestCase {
   /**
    * Clean up after each test.
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanUpFinancialEntities();
     $this->quickCleanup(['civicrm_uf_match']);
     CRM_Utils_Hook::singleton()->reset();
index 8876fccf800cc00e550942eb949a4455c94b9398..0132c809256838c6d688deaf4e87ee496ec9acb7 100644 (file)
@@ -30,7 +30,7 @@ class CRM_Contact_Page_View_UserDashboard_GroupContactTest extends CiviUnitTestC
    *
    * This method is called after a test is executed.
    */
-  protected function tearDown() {
+  protected function tearDown(): void {
     parent::tearDown();
   }
 
index e42d4e893a6a07333bab24a9fdb27dccb66ab3f7..867f9cf48c41ed558a598303c5e3d147a97988c7 100644 (file)
  */
 class CRM_Contribute_BAO_ContributionPageTest extends CiviUnitTestCase {
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->_financialTypeID = 1;
   }
 
-  public function tearDown() {
-  }
-
   /**
    * Create() method (create Contribution Page)
    */
index 83bbddffaf19f746806a068cac06aaa3dea72e03..9e05b4684e51bf4c892bb139f35135e8cf0d063c 100644 (file)
@@ -23,7 +23,7 @@ class CRM_Contribute_BAO_ContributionTest extends CiviUnitTestCase {
   /**
    * Clean up after tests.
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanUpFinancialEntities();
     parent::tearDown();
   }
index 503cc0f7bca61cba8b8586386fcda0408df0ebfc..aca4e92b5f44e0f0b2f788cbd290d465db3c0742 100644 (file)
  */
 class CRM_Contribute_BAO_ContributionTypeTest extends CiviUnitTestCase {
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->organizationCreate();
   }
 
-  public function teardown() {
+  public function tearDown(): void {
     $this->financialAccountDelete('Donations');
   }
 
index 90d416a955ae52e8df3f6be19e61802a2228fb84..f242ed60858f6af4976b79288e4e8ea6ebab9736 100644 (file)
  */
 class CRM_Contribute_BAO_ProductTest extends CiviUnitTestCase {
 
-  public function setUp() {
-    parent::setUp();
-  }
-
   /**
    * Check method add()
    */
index de58b9e1b91b60bea172a40b93618e806ada4901..cd796c30277f6694ecf6d3bdc962f94bbb8a546c 100644 (file)
@@ -7,7 +7,7 @@
  */
 class CRM_Contribute_BAO_QueryTest extends CiviUnitTestCase {
 
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanUpFinancialEntities();
     parent::tearDown();
   }
index e3e8f4a037915d66114ed3138395102077da3bb9..e6d705aa91271acb714aea920b321405eeaf7c82 100644 (file)
@@ -109,7 +109,7 @@ class CRM_Contribute_Form_AdditionalPaymentTest extends CiviUnitTestCase {
    *
    * @throws \CRM_Core_Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanUpFinancialEntities();
     $this->quickCleanup(['civicrm_mailing_spool']);
     parent::tearDown();
index 1ab47a0d783a128c93e331a90d520634c633efd9..34fdb232c59ae8c6e968f71e5d8e13135b5c3fdf 100644 (file)
@@ -21,7 +21,7 @@ class CRM_Contribute_Form_Contribution_ConfirmTest extends CiviUnitTestCase {
   /**
    * Clean up DB.
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanUpFinancialEntities();
   }
 
index dfccbc146af9aec4b99458bcea5548c8789ea71a..480e7a6ef8ba88f13caedb7c00a918db9fd1faff 100644 (file)
@@ -21,7 +21,7 @@ class CRM_Contribute_Form_Contribution_MainTest extends CiviUnitTestCase {
   /**
    * Clean up DB.
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanUpFinancialEntities();
   }
 
index aba8e8fa251bd481ff139f422553c787edd890b7..28c7d5fc7e41d857909b868987ca44c207db6cfa 100644 (file)
@@ -21,7 +21,7 @@ class CRM_Contribute_Form_Contribution_ThankYouTest extends CiviUnitTestCase {
   /**
    * Clean up DB.
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanUpFinancialEntities();
   }
 
index 50a9628c11f325b012ae3362e5a853e7a0b8b914..08df74f310da108167c2957421aab16871bc760c 100644 (file)
@@ -23,7 +23,7 @@ class CRM_Contribute_Form_ContributionPageTranslationTest extends CiviUnitTestCa
     CRM_Core_I18n_Schema::addLocale('fr_FR', 'en_US');
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     global $dbLocale;
     if ($dbLocale) {
       CRM_Core_I18n_Schema::makeSinglelingual('en_US');
index 4a708a7b1f9af75b0b69eeeffbec2f2b4155170a..3d66b71ec71350175eed6acba3f5be002ae0757b 100644 (file)
@@ -123,7 +123,7 @@ class CRM_Contribute_Form_ContributionTest extends CiviUnitTestCase {
    *
    * @throws \CRM_Core_Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanUpFinancialEntities();
     $this->quickCleanup(['civicrm_note', 'civicrm_uf_match', 'civicrm_address']);
   }
index 15a693267b6053959e593c73f85106e6652f5059..dd1291a7e2850edaff7071cec758f5c822f67fd3 100644 (file)
@@ -30,7 +30,7 @@ class CRM_Contribute_Form_SearchTest extends CiviUnitTestCase {
     $this->ids['Contact']['contactID2'] = $this->individualCreate([], 2);
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanUpFinancialEntities();
     parent::tearDown();
   }
index bee4dc15c8a60035cf743202a87b5e8eccd98480..cd103eb110d517f650674f596c5b12632241c095 100644 (file)
@@ -23,7 +23,7 @@ class CRM_Contribute_Form_Task_InvoiceTest extends CiviUnitTestCase {
   /**
    * Clean up after each test.
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanUpFinancialEntities();
     CRM_Utils_Hook::singleton()->reset();
   }
index c48d6e768945f85b0125348c2d4cd95355a5e87c..758e72ba9dd389fee34a70591a21e95bddba7789 100644 (file)
@@ -20,7 +20,7 @@ class CRM_Contribute_Form_Task_PDFLetterCommonTest extends CiviUnitTestCase {
 
   protected $_individualId;
 
-  protected $_docTypes = NULL;
+  protected $_docTypes;
 
   protected $_contactIds;
 
@@ -33,7 +33,7 @@ class CRM_Contribute_Form_Task_PDFLetterCommonTest extends CiviUnitTestCase {
    */
   protected $hookTokensCalled = 0;
 
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     $this->_individualId = $this->individualCreate(['first_name' => 'Anthony', 'last_name' => 'Collins']);
     $this->_docTypes = CRM_Core_SelectValues::documentApplicationType();
@@ -44,7 +44,7 @@ class CRM_Contribute_Form_Task_PDFLetterCommonTest extends CiviUnitTestCase {
    *
    * @throws \CRM_Core_Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanUpFinancialEntities();
     $this->quickCleanup(['civicrm_uf_match']);
     CRM_Utils_Hook::singleton()->reset();
@@ -107,7 +107,7 @@ class CRM_Contribute_Form_Task_PDFLetterCommonTest extends CiviUnitTestCase {
   /**
    * Test the buildContributionArray function.
    *
-   * @throws \CRM_Core_Exception
+   * @throws \CRM_Core_Exception|\CiviCRM_API3_Exception
    */
   public function testBuildContributionArray(): void {
     $this->_individualId = $this->individualCreate();
@@ -175,7 +175,7 @@ class CRM_Contribute_Form_Task_PDFLetterCommonTest extends CiviUnitTestCase {
    * @param array $tokens
    * @param string $className
    */
-  public function hookTokenValues(&$details, $contactIDs, $jobID, $tokens, $className) {
+  public function hookTokenValues(&$details, $contactIDs, $jobID, $tokens, $className): void {
     foreach ($details as $index => $detail) {
       $details[$index]['favourite_emoticon'] = 'emo';
     }
@@ -208,7 +208,8 @@ class CRM_Contribute_Form_Task_PDFLetterCommonTest extends CiviUnitTestCase {
       ];
       $contribution = $this->callAPISuccess('Contribution', 'create', $contributionParams);
       $contributionId = $contribution['id'];
-      $form = new CRM_Contribute_Form_Task_PDFLetter();
+      /* @var $form CRM_Contribute_Form_Task_PDFLetter */
+      $form = $this->getFormObject('CRM_Contribute_Form_Task_PDFLetter');
       $form->setContributionIds([$contributionId]);
       $format = Civi::settings()->get('dateformatFull');
       $date = CRM_Utils_Date::getToday();
@@ -280,7 +281,8 @@ class CRM_Contribute_Form_Task_PDFLetterCommonTest extends CiviUnitTestCase {
     ]);
     $contributionIDs[] = $contribution['id'];
 
-    $form = new CRM_Contribute_Form_Task_PDFLetter();
+    /* @var \CRM_Contribute_Form_Task_PDFLetter $form */
+    $form = $this->getFormObject('CRM_Contribute_Form_Task_PDFLetter');
     $form->setContributionIds($contributionIDs);
 
     $html = CRM_Contribute_Form_Task_PDFLetterCommon::postProcess($form, $formValues);
index 502c05295bc75e689df9d401f409fb9dfaf001a9..4b2ce0c1dfaf2006e4488d146a659560765da639 100644 (file)
@@ -19,7 +19,7 @@ class CRM_Contribute_Form_Task_StatusTest extends CiviUnitTestCase {
   /**
    * Clean up after each test.
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanUpFinancialEntities();
     CRM_Utils_Hook::singleton()->reset();
   }
index b222d8151f755f499d1e71bd33c58f85a29b012c..c37e43b77db249a2a7b99687e835017da009695d 100644 (file)
@@ -10,7 +10,7 @@
  */
 
 /**
- * Class CRM_Contribute_Form_Tasktest
+ * Class CRM_Contribute_Form_TaskTest
  */
 class CRM_Contribute_Form_TaskTest extends CiviUnitTestCase {
 
@@ -18,10 +18,12 @@ class CRM_Contribute_Form_TaskTest extends CiviUnitTestCase {
 
   /**
    * Clean up after each test.
+   *
+   * @throws \CRM_Core_Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanUpFinancialEntities();
-    CRM_Utils_Hook::singleton()->reset();
+    parent::tearDown();
   }
 
   /**
@@ -29,13 +31,15 @@ class CRM_Contribute_Form_TaskTest extends CiviUnitTestCase {
    * executes without any error after sorting the search result.
    *
    * @throws \CRM_Core_Exception
+   * @throws \CiviCRM_API3_Exception
    */
-  public function testPreProcessCommonAfterSorting() {
+  public function testPreProcessCommonAfterSorting(): void {
     $fields = [
       'source' => 'contribution_source',
       'status' => 'contribution_status',
       'financialTypes' => 'financial_type',
     ];
+    $contributionIds = [];
     $financialTypes = ['Member Dues', 'Event Fee', 'Donation'];
     $status = ['Completed', 'Partially paid', 'Pending'];
     $source = ['test source text', 'check source text', 'source text'];
@@ -65,9 +69,10 @@ class CRM_Contribute_Form_TaskTest extends CiviUnitTestCase {
       $expectedValues[$fld] = $sortedFields;
     }
 
-    // Assert contribIds are returned in a sorted order.
-    $form = $this->getFormObject('CRM_Contribute_Form_Task', ['radio_ts' => 'ts_all'], 'Search');
     foreach ($fields as $val) {
+      // Assert contribIds are returned in a sorted order.
+      /* @var CRM_Contribute_Form_Task $form */
+      $form = $this->getFormObject('CRM_Contribute_Form_Task', ['radio_ts' => 'ts_all'], 'Search');
       $form->set(CRM_Utils_Sort::SORT_ORDER, "`{$val}` asc");
       CRM_Contribute_Form_Task::preProcessCommon($form);
 
index e445f6e36ea5ffb6ff7f88499fe9b51b68553745..009bb8a48f3bb3e98b47dfcd2fa773d5ee0b81e8 100644 (file)
@@ -23,7 +23,7 @@ class CRM_Contribute_Import_Parser_ContributionTest extends CiviUnitTestCase {
   /**
    * Setup function.
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanUpFinancialEntities();
     parent::tearDown();
   }
index dab9941087e61be501a425811e4f343ca887995c..e8bdedddbad885c3a650e55044fbd093af9fca49 100644 (file)
@@ -18,7 +18,7 @@ class CRM_Contribute_PseudoConstantTest extends CiviUnitTestCase {
   /**
    * Clean up after tests.
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanUpFinancialEntities();
     parent::tearDown();
   }
index 70678998fd0022bf8c43c2f79d826bcad5b76f18..288a4fc0c01a6f651a2f6fe7a7e79de1998b972b 100644 (file)
@@ -16,7 +16,7 @@ class CRM_Core_BAO_CustomFieldTest extends CiviUnitTestCase {
    *
    * @throws \Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanup([], TRUE);
     parent::tearDown();
   }
index d1a103d53297d76b99452fdea6b42496754382b2..783d89a38a842c4eccb3cde0f314f8f61df17931 100644 (file)
@@ -14,7 +14,7 @@ class CRM_Core_BAO_CustomQueryTest extends CiviUnitTestCase {
    *
    * @throws \Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $tablesToTruncate = [
       'civicrm_contact',
     ];
index fb82c0ab6b104267569349fa377afc8030e64b3a..26cceaa8f62efd808a3e61e0a8cda897bd7190b8 100644 (file)
@@ -38,7 +38,7 @@ class CRM_Core_BAO_LocationTest extends CiviUnitTestCase {
    * Tears down the fixture, for example, closes a network connection.
    * This method is called after a test is executed.
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $tablesToTruncate = [
       'civicrm_contact',
       'civicrm_openid',
index fb71da022eaf7391cd7e59acbae0923e1cd3637b..fee5ff7179c971f088639fcd9293e9e464ad4aa9 100644 (file)
@@ -12,7 +12,7 @@ class CRM_Core_BAO_MappingTest extends CiviUnitTestCase {
    *
    * @throws \CRM_Core_Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanup(['civicrm_mapping_field', 'civicrm_mapping']);
     parent::tearDown();
   }
index 3bf68c709c9e0d347dcf326615ca868f1bed9f94..85b5899d440eb2803c1e9638636f142a4bd781ad 100644 (file)
@@ -8,7 +8,7 @@ use Civi\Api4\OpenID;
  */
 class CRM_Core_BAO_OpenIDTest extends CiviUnitTestCase {
 
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanup(['civicrm_contact', 'civicrm_openid', 'civicrm_email']);
     parent::tearDown();
   }
index a981de6e7ff3860cb1ac3c1c293bb757d299a61f..6c42982d6bd7d1a1efd8d494fe35921fae27a0f9 100644 (file)
  */
 class CRM_Core_BAO_RecurringEntityTest extends CiviUnitTestCase {
 
-  /**
-   * Sets up the fixture, for example, opens a network connection.
-   * This method is called before a test is executed.
-   */
-  protected function setUp() {
-    parent::setUp();
-  }
-
-  /**
-   * Tears down the fixture, for example, closes a network connection.
-   * This method is called after a test is executed.
-   */
-  protected function tearDown() {
-  }
-
   /**
    * Testing Activity Generation through Entity Recursion.
    */
index d94421f28927b3517accecd84786a7b7bbf915f8..6298c020bf1d341c650b81af2948eb9d334c1b6d 100644 (file)
@@ -24,7 +24,7 @@ class CRM_Core_BAO_SchemaHandlerTest extends CiviUnitTestCase {
    *
    * @throws \CRM_Core_Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     parent::tearDown();
     $this->callAPISuccess('System', 'updateindexes', []);
   }
index 34cf4a8f47d7e286eb3c4aa6c3ed6db4bc740286..27e3820238dd8c76efe85766251be3c1c708a4d7 100644 (file)
@@ -33,7 +33,7 @@ class CRM_Core_BAO_SettingTest extends CiviUnitTestCase {
    *
    * @throws \CRM_Core_Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     global $civicrm_setting;
     $civicrm_setting = $this->origSetting;
     $this->quickCleanup(['civicrm_contribution']);
index e4a4e8b643186af8e77347bd44c2897ba6696a4b..8edeed810e66bf2b2f6c5020dbeef933b8c5e2af 100644 (file)
@@ -129,7 +129,7 @@ class CRM_Core_CommunityMessagesTest extends CiviUnitTestCase {
     self::initWebResponses();
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     parent::tearDown();
     CRM_Utils_Time::resetTime();
   }
index 1bf6542772ee61527e38c3432bb99e143244882e..6457a85fb141d70cce2fa8aed766199316d79278 100644 (file)
@@ -48,7 +48,7 @@ class CRM_Core_DAO_AllCoreTablesTest extends CiviUnitTestCase {
     };
   }
 
-  protected function tearDown() {
+  protected function tearDown(): void {
     CRM_Utils_Hook::singleton()->reset();
     CRM_Core_DAO_AllCoreTables::init(1);
     parent::tearDown();
index 94ecc5f96f4e52fc1bea932e9872dc839939304d..c7444702132a93b005f77296c9401f33f6ae348b 100644 (file)
@@ -22,7 +22,7 @@ class CRM_Core_ErrorTest extends CiviUnitTestCase {
     $config->configAndLogDir = $this->createTempDir('test-log-');
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     $config = CRM_Core_Config::singleton();
     $config->configAndLogDir = $this->oldConfigAndLogDir;
     parent::tearDown();
index fc26206354de848632ba7d967b19b11c24ec95bd..f8d4c4009e6efa1624000fb5520a62680bb15571 100644 (file)
@@ -35,7 +35,7 @@ class CRM_Core_FieldOptionsTest extends CiviUnitTestCase {
     CRM_Utils_Hook::singleton()->setHook('civicrm_fieldOptions', [$this, 'hook_civicrm_fieldOptions']);
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     parent::tearDown();
     $this->quickCleanup(['civicrm_custom_field', 'civicrm_custom_group']);
   }
index 95f8d5e0c8c7625f2716863506060fdde8043e85..56215e64383b03c6c8f934a43318aa06baa40308 100644 (file)
  */
 class CRM_Core_I18n_LocaleTest extends CiviUnitTestCase {
 
-  public function setUp() {
-    parent::setUp();
-  }
-
-  public function tearDown() {
-    parent::tearDown();
-  }
-
   /**
    *
    */
index 4c1f04c0b519898d478908124443e6f2f86e9780..d7d7b8c5cdee7f6643561a6e4d18ed31ceaea0fb 100644 (file)
@@ -30,7 +30,7 @@ class CRM_Core_I18n_SchemaTest extends CiviUnitTestCase {
     parent::setUp();
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     CRM_Core_I18n_Schema::makeSinglelingual('en_US');
     parent::tearDown();
   }
index 8ec73a16a86fd80f07346a095a544ded57da221a..7121591d4283af820fccb3c516e08fca5fecd9ff 100644 (file)
@@ -6,7 +6,7 @@
  */
 class CRM_Core_InnoDBIndexerTest extends CiviUnitTestCase {
 
-  public function tearDown() {
+  public function tearDown(): void {
     // May or may not cleanup well if there's a bug in the indexer.
     // This is better than nothing -- and better than duplicating the
     // cleanup logic.
index a8e4c2801f99efb6807c5716101bf37e1f3cc439..8468b8fae2c54adc7644cb680cc545148f3ea53d 100644 (file)
@@ -97,7 +97,7 @@ class CRM_Core_ManagedEntitiesTest extends CiviUnitTestCase {
     $this->apiKernel->registerApiProvider($this->adhocProvider);
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     parent::tearDown();
     \Civi::reset();
   }
index 508f7293221073be5534014234627a06e594959f..ed1bfcf702cb8cb9b415537865199a16605e7028 100644 (file)
@@ -39,7 +39,7 @@ class CRM_Core_Payment_AuthorizeNetIPNTest extends CiviUnitTestCase {
     $this->_contributionPageID = $contributionPage['id'];
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanUpFinancialEntities();
   }
 
index 4e1bab5c6bc04706e190282926de4c1e454833d6..94ec92778f36eb7e4359b384ce63b2de8c04edf1 100644 (file)
@@ -31,7 +31,7 @@ class CRM_Core_Payment_AuthorizeNetTest extends CiviUnitTestCase {
     $GLOBALS['_PEAR_ERRORSTACK_OVERRIDE_CALLBACK'] = [];
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanUpFinancialEntities();
   }
 
index 930819c0c3dc0d4c3222616a362bfa2ced33384d..6ea7622e3fb87a01b0dca2553f682d426dcdd1bb 100644 (file)
@@ -93,7 +93,7 @@ class CRM_Core_Payment_BaseIPNTest extends CiviUnitTestCase {
   /**
    * Tear down after class.
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanUpFinancialEntities();
     CRM_Member_PseudoConstant::membershipStatus(NULL, NULL, 'name', TRUE);
   }
index 80a030be6ab99585cd62ea2940c379b450101375..910a6d300f9a4858b5e0f35c02f413c717ad5c36 100644 (file)
@@ -26,7 +26,7 @@ class CRM_Core_Payment_PayPalIPNTest extends CiviUnitTestCase {
   /**
    * Set up function.
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->_paymentProcessorID = $this->paymentProcessorCreate(['is_test' => 0, 'payment_processor_type_id' => 'PayPal_Standard']);
     $this->_contactID = $this->individualCreate();
@@ -42,7 +42,7 @@ class CRM_Core_Payment_PayPalIPNTest extends CiviUnitTestCase {
   /**
    * Tear down function.
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanUpFinancialEntities();
     parent::tearDown();
   }
index 201b5cc07db3d4f7456349855ac19a876012389e..d5ee6ce62132294c8a8d393b20ff9fcea232a19d 100644 (file)
@@ -47,7 +47,7 @@ class CRM_Core_Payment_PayPalProIPNTest extends CiviUnitTestCase {
   /**
    * Tear down function.
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanUpFinancialEntities();
   }
 
index 5a96d6e496b00c8d31c2e7c07a2bbc221c5502f6..f4be1f12752b4a3a611954991658c34d2740190f 100644 (file)
@@ -27,7 +27,7 @@ class CRM_Core_Payment_PaypalProTest extends CiviUnitTestCase {
     $this->processor = Civi\Payment\System::singleton()->getById($this->ids['PaymentProcessor']['paypal_pro']);
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanUpFinancialEntities();
     parent::tearDown();
   }
index 92a28eb376ad443369797375fde6980b8605978e..7b9335590a5f1f1cea9cb0c245a71e963cc4c97b 100644 (file)
@@ -40,7 +40,7 @@ class CRM_Core_Payment_PaypalStdTest extends CiviUnitTestCase {
   /**
    * @throws \CRM_Core_Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanUpFinancialEntities();
     parent::tearDown();
   }
index 82c6e9c1984da1936dc0901d317f84eeaf43e596..a7756380f4f5cd0b29f0c586c006bf9a3e235d02 100644 (file)
@@ -26,7 +26,7 @@ class CRM_Dedupe_DedupeFinderTest extends CiviUnitTestCase {
    *
    * @throws \CRM_Core_Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
 
     foreach ($this->contactIDs as $contactId) {
       $this->contactDelete($contactId);
index 8d0c38befc1e14e0063d2d8f5ffba4685daca51c..4c172c23fb8b1dd438996756e56ed8e8fd7d0cc9 100644 (file)
@@ -40,7 +40,7 @@ class CRM_Event_BAO_AdditionalPaymentTest extends CiviUnitTestCase {
    *
    * @throws \CRM_Core_Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->eventDelete($this->_eventId);
     $this->quickCleanUpFinancialEntities();
   }
index 329850de106deb12fc510a5069a12db7a9c8f748..a92d7cd7f58d1a36cd13d00bf702efaaff941dce 100644 (file)
@@ -78,7 +78,7 @@ class CRM_Event_BAO_ChangeFeeSelectionTest extends CiviUnitTestCase {
   /**
    * Clean up after test.
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->eventDelete($this->_eventId);
     $this->quickCleanUpFinancialEntities();
   }
index 1d67e841c47bf35e41ba0a0c5eece6225b0084f2..f70b6f95884d51e728864227886004bf7ccd3025 100644 (file)
  */
 class CRM_Event_BAO_ParticipantStatusTest extends CiviUnitTestCase {
 
-  /**
-   * Sets up the fixture, for example, opens a network connection.
-   * This method is called before a test is executed.
-   */
-  protected function setUp() {
-    parent::setUp();
-  }
-
-  /**
-   * Tears down the fixture, for example, closes a network connection.
-   * This method is called after a test is executed.
-   */
-  protected function tearDown() {
-  }
-
   /**
    *  create() and deleteParticipantStatusType() method
    */
index 16b6a39dfdfb99f0f79ec548d6f024af21c2fae8..7899cf2ff1fdd27c74c1d264f923df2e23ec18da 100644 (file)
@@ -34,7 +34,7 @@ class CRM_Event_Form_SearchTest extends CiviUnitTestCase {
     ]);
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanUpFinancialEntities();
     parent::tearDown();
   }
index c35ce4bebe49da0de2fa9f0da54ce41d9e09408b..9bc95db1d9cf3f73b08ce31047e486753c764ff4 100644 (file)
@@ -73,7 +73,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    *
    * @throws \Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanUpFinancialEntities();
     $this->quickCleanup([
       'civicrm_contact',
@@ -108,7 +108,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    * @throws \CRM_Core_Exception
    * @throws \League\Csv\Exception
    */
-  public function testExportComponentsNull() {
+  public function testExportComponentsNull(): void {
     $this->doExportTest([]);
   }
 
@@ -118,7 +118,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    * @throws \CRM_Core_Exception
    * @throws \League\Csv\Exception
    */
-  public function testExportComponentsContribution() {
+  public function testExportComponentsContribution(): void {
     $this->setUpContributionExportData();
     $selectedFields = [
       ['contact_type' => 'Individual', 'name' => 'first_name'],
@@ -141,15 +141,14 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
       'componentClause' => 'civicrm_contribution.id IN ( ' . implode(',', $this->contributionIDs) . ')',
     ]);
     $this->assertContains('display', array_values($this->csv->getHeader()));
-    $row = $this->csv->fetchOne(0);
+    $row = $this->csv->fetchOne();
     $this->assertEquals('This is a test', $row['display']);
   }
 
   /**
    * Implements hook_civicrm_export().
-   *
    */
-  public function confirmHookWasCalled(&$exportTempTable, &$headerRows, &$sqlColumns, $exportMode, $componentTable, $ids) {
+  public function confirmHookWasCalled($exportTempTable, &$headerRows, &$sqlColumns, $exportMode, $componentTable, $ids): void {
     $sqlColumns['display'] = 'display varchar(255)';
     $headerRows[] = 'display';
     CRM_Core_DAO::executeQuery("ALTER TABLE $exportTempTable ADD COLUMN display varchar(255)");
@@ -162,7 +161,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    * @throws \CRM_Core_Exception
    * @throws \League\Csv\Exception
    */
-  public function testExportComponentsContributionSoftCredits() {
+  public function testExportComponentsContributionSoftCredits(): void {
     $this->setUpContributionExportData();
     $this->callAPISuccess('ContributionSoft', 'create', ['contact_id' => $this->contactIDs[1], 'contribution_id' => $this->contributionIDs[0], 'amount' => 5]);
     $params = [
@@ -185,7 +184,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
 
     $this->assertEquals(array_merge($this->getBasicHeaderDefinition(FALSE), $this->getContributeHeaderDefinition()), $this->csv->getHeader());
     $this->assertCount(3, $this->csv);
-    $row = $this->csv->fetchOne(0);
+    $row = $this->csv->fetchOne();
     $this->assertEquals(95, $row['Net Amount']);
     $this->assertEquals('', $row['Soft Credit Amount']);
     $row = $this->csv->fetchOne(1);
@@ -206,7 +205,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    * @throws \CRM_Core_Exception
    * @throws \League\Csv\Exception
    */
-  public function testExportComponentsMembership() {
+  public function testExportComponentsMembership(): void {
     $this->setUpMembershipExportData();
     $this->doExportTest([
       'selectAll' => TRUE,
@@ -326,9 +325,10 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    * Basic test to ensure the exportComponents function can export selected fields for activity
    *
    * @throws \CRM_Core_Exception
+   * @throws \CiviCRM_API3_Exception
    * @throws \League\Csv\Exception
    */
-  public function testExportComponentsActivity() {
+  public function testExportComponentsActivity(): void {
     $this->setUpActivityExportData();
     $selectedFields = [
       ['contact_type' => 'Individual', 'name' => 'display_name'],
@@ -356,7 +356,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    * repeated 100,000 times and in general we should simply be able to match the query fields to
    * our expected rows & do a little pseudoconstant mapping.
    */
-  public function testGetExportStructureArrays() {
+  public function testGetExportStructureArrays(): void {
     // This is how return properties are formatted internally within the function for passing to the BAO query.
     $returnProperties = [
       'first_name' => 1,
@@ -384,21 +384,21 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
       FALSE, TRUE, TRUE, NULL, 'AND'
     );
 
-    list($select) = $query->query();
+    [$select] = $query->query();
     $pattern = '/as `?([^`,]*)/';
     $queryFieldAliases = [];
-    preg_match_all($pattern, $select, $queryFieldAliases, PREG_PATTERN_ORDER);
+    preg_match_all($pattern, $select, $queryFieldAliases);
     $processor = new CRM_Export_BAO_ExportProcessor(CRM_Contact_BAO_Query::MODE_CONTRIBUTE, NULL, 'AND');
     $processor->setQueryFields($query->_fields);
     $processor->setReturnProperties($returnProperties);
 
-    list($outputFields) = $processor->getExportStructureArrays();
+    [$outputFields] = $processor->getExportStructureArrays();
     foreach (array_keys($outputFields) as $fieldAlias) {
       if ($fieldAlias === 'Home-country') {
-        $this->assertTrue(in_array($fieldAlias . '_id', $queryFieldAliases[1]), 'Country is subject to some funky translate so we make sure country id is present');
+        $this->assertContains($fieldAlias . '_id', $queryFieldAliases[1], 'Country is subject to some funky translate so we make sure country id is present');
       }
       else {
-        $this->assertTrue(in_array($fieldAlias, $queryFieldAliases[1]), 'looking for field ' . $fieldAlias . ' in generaly the alias fields need to match the outputfields');
+        $this->assertContains($fieldAlias, $queryFieldAliases[1], 'looking for field ' . $fieldAlias . ' in generaly the alias fields need to match the outputfields');
       }
     }
 
@@ -408,8 +408,9 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    * Set up some data for us to do testing on.
    *
    * @throws \CRM_Core_Exception
+   * @throws \CiviCRM_API3_Exception
    */
-  public function setUpContributionExportData() {
+  public function setUpContributionExportData(): void {
     $this->setUpContactExportData();
     $this->contributionIDs[] = $this->contributionCreate(['contact_id' => $this->contactIDs[0], 'trxn_id' => 'null', 'invoice_id' => 'null', 'receive_date' => '2019-07-25 07:34:23']);
     $this->contributionIDs[] = $this->contributionCreate(['contact_id' => $this->contactIDs[1], 'trxn_id' => 'null', 'invoice_id' => 'null', 'receive_date' => '2018-12-01 00:00:00']);
@@ -419,8 +420,9 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    * Set up some data for us to do testing on.
    *
    * @throws \CRM_Core_Exception
+   * @throws \CiviCRM_API3_Exception
    */
-  public function setUpMembershipExportData() {
+  public function setUpMembershipExportData(): void {
     $this->setUpContactExportData();
     // Create an extra so we don't get false passes due to 1
     $this->contactMembershipCreate(['contact_id' => $this->contactIDs[0]]);
@@ -440,8 +442,9 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    * Set up data to test case export.
    *
    * @throws \CRM_Core_Exception
+   * @throws \CiviCRM_API3_Exception
    */
-  public function setupCaseExportData() {
+  public function setupCaseExportData(): void {
     $contactID1 = $this->individualCreate();
     $contactID2 = $this->individualCreate([], 1);
 
@@ -460,8 +463,9 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    * Set up some data for us to do testing on.
    *
    * @throws \CRM_Core_Exception
+   * @throws \CiviCRM_API3_Exception
    */
-  public function setUpActivityExportData() {
+  public function setUpActivityExportData(): void {
     $this->setUpContactExportData();
     $this->activityIDs[] = $this->activityCreate(['contact_id' => $this->contactIDs[0]])['id'];
   }
@@ -470,8 +474,9 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    * Set up some data for us to do testing on.
    *
    * @throws \CRM_Core_Exception
+   * @throws \CiviCRM_API3_Exception
    */
-  public function setUpContactExportData() {
+  public function setUpContactExportData(): void {
     $this->contactIDs[] = $contactA = $this->individualCreate(['gender_id' => 'Female']);
     // Create address for contact A.
     $params = [
@@ -513,12 +518,13 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    *
    * @param int $isPrimaryOnly
    *
-   * @dataProvider getBooleanDataProvider
    * @throws \CRM_Core_Exception
+   * @throws \CiviCRM_API3_Exception
    * @throws \League\Csv\Exception
+   * @dataProvider getBooleanDataProvider
    */
-  public function testExportPrimaryAddress($isPrimaryOnly) {
-    \Civi::settings()->set('searchPrimaryDetailsOnly', $isPrimaryOnly);
+  public function testExportPrimaryAddress($isPrimaryOnly): void {
+    Civi::settings()->set('searchPrimaryDetailsOnly', $isPrimaryOnly);
     $this->setUpContactExportData();
 
     $selectedFields = [
@@ -540,8 +546,8 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
       'Home-Email' => 'home@example.com',
       'Work-Email' => 'work@example.com',
     ], $row);
-    $this->assertEquals(2, count($this->csv));
-    \Civi::settings()->set('searchPrimaryDetailsOnly', FALSE);
+    $this->assertCount(2, $this->csv);
+    Civi::settings()->set('searchPrimaryDetailsOnly', FALSE);
   }
 
   /**
@@ -551,9 +557,10 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    * does NOT retain the gender of the former.
    *
    * @throws \CRM_Core_Exception
+   * @throws \CiviCRM_API3_Exception
    * @throws \League\Csv\Exception
    */
-  public function testExportPseudoField() {
+  public function testExportPseudoField(): void {
     $this->setUpContactExportData();
     $this->callAPISuccess('OptionValue', 'create', ['option_group_id' => 'gender', 'name' => 'Really long string', 'value' => 678, 'label' => 'Really long string']);
     $selectedFields = [['contact_type' => 'Individual', 'name' => 'gender_id']];
@@ -571,7 +578,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    * @throws \CRM_Core_Exception
    * @throws \League\Csv\Exception
    */
-  public function testExportPseudoFieldCampaign() {
+  public function testExportPseudoFieldCampaign(): void {
     $this->setUpContributionExportData();
     $campaign = $this->callAPISuccess('Campaign', 'create', ['title' => 'Big campaign and kinda long too']);
     $this->callAPISuccess('Contribution', 'create', ['campaign_id' => $campaign['id'], 'id' => $this->contributionIDs[0]]);
@@ -595,9 +602,10 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    * Test exporting relationships.
    *
    * @throws \CRM_Core_Exception
+   * @throws \CiviCRM_API3_Exception
    * @throws \League\Csv\Exception
    */
-  public function testExportRelationships() {
+  public function testExportRelationships(): void {
     $organization1 = $this->organizationCreate(['organization_name' => 'Org 1', 'legal_name' => 'pretty legal', 'contact_source' => 'friend who took a law paper once']);
     $organization2 = $this->organizationCreate(['organization_name' => 'Org 2', 'legal_name' => 'well dodgey']);
     $contact1 = $this->individualCreate(['employer_id' => $organization1, 'first_name' => 'one']);
@@ -638,8 +646,8 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    * @throws CRM_Core_Exception
    * @throws \League\Csv\Exception
    */
-  public function testExportRelationshipsMergeToHousehold($includeHouseHold) {
-    list($householdID, $houseHoldTypeID) = $this->setUpHousehold();
+  public function testExportRelationshipsMergeToHousehold($includeHouseHold): void {
+    [$householdID, $houseHoldTypeID] = $this->setUpHousehold();
 
     if ($includeHouseHold) {
       $this->contactIDs[] = $householdID;
@@ -676,8 +684,8 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    * @throws CRM_Core_Exception
    * @throws \League\Csv\Exception
    */
-  public function testExportMergeToHousehold($includeHouseHold) {
-    list($householdID, $houseHoldTypeID) = $this->setUpHousehold();
+  public function testExportMergeToHousehold($includeHouseHold): void {
+    [$householdID, $houseHoldTypeID] = $this->setUpHousehold();
 
     if ($includeHouseHold) {
       $this->contactIDs[] = $householdID;
@@ -704,8 +712,8 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    * @throws \CRM_Core_Exception
    * @throws \League\Csv\Exception
    */
-  public function testExportRelationshipsMergeToHouseholdAllFields() {
-    list($householdID) = $this->setUpHousehold();
+  public function testExportRelationshipsMergeToHouseholdAllFields(): void {
+    [$householdID] = $this->setUpHousehold();
     $this->doExportTest(['ids' => $this->contactIDs, 'mergeSameHousehold' => TRUE]);
     $row = $this->csv->fetchOne();
     $this->assertCount(1, $this->csv);
@@ -722,10 +730,11 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    *
    * @throws \API_Exception
    * @throws \CRM_Core_Exception
+   * @throws \CiviCRM_API3_Exception
    * @throws \Civi\API\Exception\UnauthorizedException
    * @throws \League\Csv\Exception
    */
-  public function testExportCustomData() {
+  public function testExportCustomData(): void {
     $this->setUpContactExportData();
     $this->entity = 'Contact';
     $this->createCustomGroupWithFieldsOfAllTypes();
@@ -768,11 +777,12 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    * Attempt to do a fairly full export of location data.
    *
    * @throws \CRM_Core_Exception
+   * @throws \CiviCRM_API3_Exception
    * @throws \League\Csv\Exception
    */
-  public function testExportIMData() {
+  public function testExportIMData(): void {
     // Use default providers.
-    $providers = ['Aim', 'Gtalk', 'Jabber', 'Msn', 'Skype', 'Yahoo'];
+    $providers = ['AIM' => 'Aim', 'GTalk' => 'Gtalk', 'Jabber' => 'Jabber', 'MSN' => 'Msn', 'Skype' => 'Skype', 'Yahoo' => 'Yahoo'];
     // Main sure labels are not all anglo chars.
     $this->diversifyLocationTypes();
 
@@ -833,8 +843,11 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
 
     foreach ($this->csv->getRecords() as $row) {
       $id = $row['Contact ID'];
-      $this->assertEquals('AIM', $row['Billing-IM Provider']);
-      $this->assertEquals('AIM', $row['Whare Kai-IM Provider']);
+      // The provider could be any of them as we created multiple ims for each location
+      // type. In earlier mysql versions it gets a somewhat consistent result but there
+      // is no 'right' provider so we just check it is a resolved pseudoconstant.
+      $this->assertContains($row['Billing-IM Provider'], array_keys($providers));
+      $this->assertContains($row['Whare Kai-IM Provider'], array_keys($providers));
       $this->assertEquals('BillingJabber' . $id, $row['Billing-IM Screen Name-Jabber']);
       $this->assertEquals('Whare KaiJabber' . $id, $row['Whare Kai-IM Screen Name-Jabber']);
       $this->assertEquals('BillingSkype' . $id, $row['Billing-IM Screen Name-Skype']);
@@ -852,10 +865,11 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    *
    * @throws \API_Exception
    * @throws \CRM_Core_Exception
+   * @throws \CiviCRM_API3_Exception
    * @throws \Civi\API\Exception\UnauthorizedException
    * @throws \League\Csv\Exception
    */
-  public function testExportPhoneData() {
+  public function testExportPhoneData(): void {
     $this->contactIDs[] = $this->individualCreate();
     $this->contactIDs[] = $this->individualCreate();
 
@@ -928,9 +942,10 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    * Export City against multiple location types.
    *
    * @throws \CRM_Core_Exception
+   * @throws \CiviCRM_API3_Exception
    * @throws \League\Csv\Exception
    */
-  public function testExportAddressData() {
+  public function testExportAddressData(): void {
     $this->diversifyLocationTypes();
 
     $locationTypes = ['Billing' => 'Billing', 'Home' => 'Home', 'Main' => 'Méin', 'Other' => 'Other', 'Whare Kai' => 'Whare Kai'];
@@ -1040,9 +1055,10 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    * Test master_address_id field when no merge is in play.
    *
    * @throws \CRM_Core_Exception
+   * @throws \CiviCRM_API3_Exception
    * @throws \League\Csv\Exception
    */
-  public function testExportMasterAddress() {
+  public function testExportMasterAddress(): void {
     $this->setUpContactExportData();
 
     //export the master address for contact B
@@ -1061,9 +1077,10 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    * Test merging same address when specifying fields.
    *
    * @throws \CRM_Core_Exception
+   * @throws \CiviCRM_API3_Exception
    * @throws \League\Csv\Exception
    */
-  public function testMergeSameAddressSpecifyFields() {
+  public function testMergeSameAddressSpecifyFields(): void {
     $this->setUpContactSameAddressExportData();
     $this->doExportTest(['mergeSameAddress' => TRUE, 'fields' => [['contact_type' => 'Individual', 'name' => 'master_id', 'location_type_id' => 1]]]);
   }
@@ -1072,9 +1089,10 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    * Test the merge same address option.
    *
    * @throws \CRM_Core_Exception
+   * @throws \CiviCRM_API3_Exception
    * @throws \League\Csv\Exception
    */
-  public function testMergeSameAddress() {
+  public function testMergeSameAddress(): void {
     $this->setUpContactSameAddressExportData();
     $this->doExportTest(['mergeSameAddress' => TRUE]);
     // ie 2 merged, one extra.
@@ -1176,9 +1194,10 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    * Tests the options for greeting templates when choosing to merge same address.
    *
    * @throws \CRM_Core_Exception
+   * @throws \CiviCRM_API3_Exception
    * @throws \League\Csv\Exception
    */
-  public function testMergeSameAddressGreetingOptions() {
+  public function testMergeSameAddressGreetingOptions(): void {
     $this->setUpContactSameAddressExportData();
     $this->callAPISuccess('OptionValue', 'create', [
       'option_group_id' => 'postal_greeting',
@@ -1213,7 +1232,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    * @throws \CRM_Core_Exception
    * @throws \League\Csv\Exception
    */
-  public function testExportNoRows() {
+  public function testExportNoRows(): void {
     $contactA = $this->callAPISuccess('contact', 'create', [
       'first_name' => 'John',
       'last_name' => 'Doe',
@@ -1243,9 +1262,10 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    * So C take preference over A and thus C is exported as result.
    *
    * @throws \CRM_Core_Exception
+   * @throws \CiviCRM_API3_Exception
    * @throws \League\Csv\Exception
    */
-  public function testMergeSameAddressOnExport() {
+  public function testMergeSameAddressOnExport(): void {
     $this->individualCreate();
     $householdID = $this->setUpHousehold()[0];
     $contactIDs = array_merge($this->contactIDs, [$householdID]);
@@ -1283,7 +1303,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    * @throws \CRM_Core_Exception
    * @throws \League\Csv\Exception
    */
-  public function testExportDeceasedDoNotMail($reason, $addressReason) {
+  public function testExportDeceasedDoNotMail($reason, $addressReason): void {
     $contactA = $this->callAPISuccess('contact', 'create', [
       'first_name' => 'John',
       'last_name' => 'Doe',
@@ -1343,9 +1363,9 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
         'mergeSameAddress' => TRUE,
       ],
     ]);
-    $row = $this->csv->fetchOne(0);
+    $row = $this->csv->fetchOne();
 
-    $this->assertTrue(!in_array('Stage', $this->processor->getHeaderRows()));
+    $this->assertNotTrue(in_array('Stage', $this->processor->getHeaderRows()));
     $this->assertEquals('Dear John', $row['Email Greeting']);
     $this->assertCount(1, $this->csv);
   }
@@ -1355,7 +1375,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    *
    * @return array
    */
-  public function getReasonsNotToMail() {
+  public function getReasonsNotToMail(): array {
     return [
       [['is_deceased' => 1], []],
       [['do_not_mail' => 1], []],
@@ -1368,9 +1388,10 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    *
    * @return array
    *
-   * @throws CRM_Core_Exception
+   * @throws \CRM_Core_Exception
+   * @throws \CiviCRM_API3_Exception
    */
-  protected function setUpHousehold() {
+  protected function setUpHousehold(): array {
     $this->setUpContactExportData();
     $householdID = $this->householdCreate([
       'source' => 'household sauce',
@@ -1406,7 +1427,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    *
    * @param int $exportMode
    */
-  public function ensureComponentIsEnabled($exportMode) {
+  public function ensureComponentIsEnabled($exportMode): void {
     if ($exportMode === CRM_Export_Form_Select::CASE_EXPORT) {
       CRM_Core_BAO_ConfigSetting::enableComponent('CiviCase');
     }
@@ -1420,7 +1441,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    * @param int $exportMode
    * @param $expected
    */
-  public function testAdditionalReturnProperties($exportMode, $expected) {
+  public function testAdditionalReturnProperties($exportMode, $expected): void {
     $this->ensureComponentIsEnabled($exportMode);
     $processor = new CRM_Export_BAO_ExportProcessor($exportMode, NULL, 'AND');
     $metadata = $processor->getAdditionalReturnProperties();
@@ -1435,7 +1456,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    * @param int $exportMode
    * @param $expected
    */
-  public function testDefaultReturnProperties($exportMode, $expected) {
+  public function testDefaultReturnProperties($exportMode, $expected): void {
     $this->ensureComponentIsEnabled($exportMode);
     $processor = new CRM_Export_BAO_ExportProcessor($exportMode, NULL, 'AND');
     $metadata = $processor->getDefaultReturnProperties();
@@ -1447,7 +1468,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    *
    * @return array
    */
-  public function additionalFieldsDataProvider() {
+  public function additionalFieldsDataProvider(): array {
     return [
       [
         'anything that will then be defaulting ton contact',
@@ -1484,7 +1505,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
   /**
    * get data for testing field metadata by query mode.
    */
-  public function allFieldsDataProvider() {
+  public function allFieldsDataProvider(): array {
     return [
       [
         'anything that will then be defaulting ton contact',
@@ -1520,7 +1541,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
   /**
    * Get return properties manually added in.
    */
-  public function getExtraReturnProperties() {
+  public function getExtraReturnProperties(): array {
     return [];
   }
 
@@ -1532,7 +1553,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    *
    * @return array
    */
-  protected function getBasicReturnProperties($isContactMode) {
+  protected function getBasicReturnProperties($isContactMode): array {
     $returnProperties = [
       'id' => 1,
       'contact_type' => 1,
@@ -1634,7 +1655,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    *
    * @return array
    */
-  public function getPledgeReturnProperties() {
+  public function getPledgeReturnProperties(): array {
     return [
       'contact_type' => 1,
       'contact_sub_type' => 1,
@@ -1672,7 +1693,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    *
    * @return array
    */
-  public function getMembershipReturnProperties() {
+  public function getMembershipReturnProperties(): array {
     return [
       'contact_type' => 1,
       'contact_sub_type' => 1,
@@ -1700,7 +1721,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    *
    * @return array
    */
-  public function getEventReturnProperties() {
+  public function getEventReturnProperties(): array {
     return [
       'contact_type' => 1,
       'contact_sub_type' => 1,
@@ -1735,7 +1756,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    *
    * @return array
    */
-  public function getActivityReturnProperties() {
+  public function getActivityReturnProperties(): array {
     return [
       'activity_id' => 1,
       'contact_type' => 1,
@@ -1766,7 +1787,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    *
    * @return array
    */
-  public function getCaseReturnProperties() {
+  public function getCaseReturnProperties(): array {
     return [
       'contact_type' => 1,
       'contact_sub_type' => 1,
@@ -1799,7 +1820,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    *
    * @return array
    */
-  public function getContributionReturnProperties() {
+  public function getContributionReturnProperties(): array {
     return [
       'contact_type' => 1,
       'contact_sub_type' => 1,
@@ -1853,7 +1874,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    *
    * @dataProvider getSqlColumnsOutput
    */
-  public function testGetSQLColumnsAndHeaders($exportMode, $expected, $expectedHeaders) {
+  public function testGetSQLColumnsAndHeaders($exportMode, $expected, $expectedHeaders): void {
     $this->ensureComponentIsEnabled($exportMode);
     // We need some data so that we can get to the end of the export
     // function. Hopefully one day that won't be required to get metadata info out.
@@ -1873,9 +1894,10 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    * https://lab.civicrm.org/dev/core/issues/819
    *
    * @throws \CRM_Core_Exception
+   * @throws \CiviCRM_API3_Exception
    * @throws \League\Csv\Exception
    */
-  public function testExportIncompleteSubmission() {
+  public function testExportIncompleteSubmission(): void {
     $this->setUpContactExportData();
     $this->doExportTest(['fields' => [['contact_type' => 'Individual', 'name' => '']], 'ids' => [$this->contactIDs[1]]]);
   }
@@ -1892,7 +1914,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    * @throws \CRM_Core_Exception
    * @throws \League\Csv\Exception
    */
-  public function testExportSpecifyFields($exportMode, $selectedFields, $expected) {
+  public function testExportSpecifyFields($exportMode, $selectedFields, $expected): void {
     $this->ensureComponentIsEnabled($exportMode);
     $this->setUpContributionExportData();
     $this->doExportTest(['fields' => $selectedFields, 'ids' => [$this->contactIDs[1]], 'exportMode' => $exportMode]);
@@ -1905,7 +1927,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    * @throws \CRM_Core_Exception
    * @throws \League\Csv\Exception
    */
-  public function textExportParticipantSpecifyFieldsNoPayment() {
+  public function textExportParticipantSpecifyFieldsNoPayment(): void {
     $selectedFields = $this->getAllSpecifiableParticipantReturnFields();
     foreach ($selectedFields as $index => $field) {
       if (substr($field[1], 0, 22) === 'componentPaymentField_') {
@@ -1929,7 +1951,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    * @todo - still being built up.
    *
    */
-  public function getAllSpecifiableReturnFields() {
+  public function getAllSpecifiableReturnFields(): array {
     return [
       [
         CRM_Export_Form_Select::EVENT_EXPORT,
@@ -1944,7 +1966,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    *
    * @return array
    */
-  public function getAllSpecifiableParticipantReturnColumns() {
+  public function getAllSpecifiableParticipantReturnColumns(): array {
     return [
       'participant_campaign_id' => '`participant_campaign_id` varchar(16)',
       'participant_contact_id' => '`participant_contact_id` varchar(16)',
@@ -1982,7 +2004,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
   /**
    * @return array
    */
-  public function getAllSpecifiableParticipantReturnFields() {
+  public function getAllSpecifiableParticipantReturnFields(): array {
     return [
       0 =>
         [
@@ -2149,8 +2171,11 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
 
   /**
    * @param string $exportMode
+   *
+   * @throws \CRM_Core_Exception
+   * @throws \CiviCRM_API3_Exception
    */
-  public function setupBaseExportData($exportMode) {
+  public function setupBaseExportData($exportMode): void {
     $this->createLoggedInUser();
     if ($exportMode === CRM_Export_Form_Select::CASE_EXPORT) {
       $this->setupCaseExportData();
@@ -2171,7 +2196,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    *
    * @return array
    */
-  public function getSqlColumnsOutput() {
+  public function getSqlColumnsOutput(): array {
     return [
       [
         'anything that will then be defaulting ton contact',
@@ -2219,7 +2244,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    *
    * @return array
    */
-  protected function getBasicHeaderDefinition($isContactExport) {
+  protected function getBasicHeaderDefinition($isContactExport): array {
     $headers = [
       0 => 'Contact ID',
       1 => 'Contact Type',
@@ -2321,7 +2346,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    *
    * @return array
    */
-  protected function getActivityHeaderDefinition() {
+  protected function getActivityHeaderDefinition(): array {
     return [
       82 => 'Activity ID',
       83 => 'Activity Type',
@@ -2348,7 +2373,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    *
    * @return array
    */
-  protected function getCaseHeaderDefinition() {
+  protected function getCaseHeaderDefinition(): array {
     return [
       82 => 'Contact ID',
       83 => 'Case ID',
@@ -2376,7 +2401,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    *
    * @return array
    */
-  protected function getContributeHeaderDefinition() {
+  protected function getContributeHeaderDefinition(): array {
     return [
       82 => 'Financial Type',
       83 => 'Contribution Source',
@@ -2419,7 +2444,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    *
    * @return array
    */
-  protected function getParticipantHeaderDefinition() {
+  protected function getParticipantHeaderDefinition(): array {
     return [
       82 => 'Event ID',
       83 => 'Event Title',
@@ -2450,7 +2475,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    *
    * @return array
    */
-  protected function getMemberHeaderDefinition() {
+  protected function getMemberHeaderDefinition(): array {
     return [
       82 => 'Membership Type',
       83 => 'Test',
@@ -2474,7 +2499,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    *
    * @return array
    */
-  protected function getPledgeHeaderDefinition() {
+  protected function getPledgeHeaderDefinition(): array {
     return [
       82 => 'Pledge ID',
       83 => 'Total Pledged',
@@ -2510,7 +2535,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    *
    * @return array
    */
-  protected function getBasicSqlColumnDefinition($isContactExport) {
+  protected function getBasicSqlColumnDefinition($isContactExport): array {
     $columns = [
       'civicrm_primary_id' => '`civicrm_primary_id` varchar(16)',
       'contact_type' => '`contact_type` varchar(64)',
@@ -2612,7 +2637,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    *
    * @return array
    */
-  protected function getCaseSqlColumns() {
+  protected function getCaseSqlColumns(): array {
     return [
       'case_start_date' => '`case_start_date` varchar(32)',
       'case_end_date' => '`case_end_date` varchar(32)',
@@ -2640,7 +2665,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    *
    * @return array
    */
-  protected function getActivitySqlColumns() {
+  protected function getActivitySqlColumns(): array {
     return [
       'activity_id' => '`activity_id` varchar(16)',
       'activity_type' => '`activity_type` varchar(255)',
@@ -2667,7 +2692,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    *
    * @return array
    */
-  protected function getParticipantSqlColumns() {
+  protected function getParticipantSqlColumns(): array {
     return [
       'event_id' => '`event_id` varchar(16)',
       'event_title' => '`event_title` varchar(255)',
@@ -2698,7 +2723,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    *
    * @return array
    */
-  public function getContributionSqlColumns() {
+  public function getContributionSqlColumns(): array {
     return [
       'civicrm_primary_id' => '`civicrm_primary_id` varchar(16)',
       'contact_type' => '`contact_type` varchar(64)',
@@ -2821,7 +2846,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    *
    * @return array
    */
-  public function getPledgeSqlColumns() {
+  public function getPledgeSqlColumns(): array {
     return [
       'pledge_id' => '`pledge_id` varchar(16)',
       'pledge_amount' => '`pledge_amount` varchar(32)',
@@ -2855,7 +2880,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    *
    * @return array
    */
-  public function getMembershipSqlColumns() {
+  public function getMembershipSqlColumns(): array {
     return [
       'membership_type' => '`membership_type` varchar(128)',
       'member_is_test' => '`member_is_test` varchar(16)',
@@ -2881,7 +2906,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    * - name differs from label
    * - non-anglo char in the label (not valid in the name).
    */
-  protected function diversifyLocationTypes() {
+  protected function diversifyLocationTypes(): void {
     $this->locationTypes['Main'] = $this->callAPISuccess('Location_type', 'get', [
       'name' => 'Main',
       'return' => 'id',
@@ -2908,7 +2933,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    * @throws \CRM_Core_Exception
    * @throws \League\Csv\Exception
    */
-  protected function doExportTest($params) {
+  protected function doExportTest($params): void {
     $fields = $params['fields'] ?? [];
     $fieldDefaults = ['contact_type' => 'Individual', 'phone_type_id' => NULL, 'location_type_id' => NULL];
     foreach ($fields as $key => $field) {
@@ -2949,11 +2974,11 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    * @param array $row
    * @param array $alternatives
    */
-  protected function assertExpectedOutput(array $expected, array $row, array $alternatives = []) {
+  protected function assertExpectedOutput(array $expected, array $row, array $alternatives = []): void {
     $variableFields = ['Created Date', 'Modified Date', 'Contact Hash'];
     foreach ($expected as $key => $value) {
       if (in_array($key, $variableFields)) {
-        $this->assertTrue(!empty($row[$key]));
+        $this->assertNotTrue(empty($row[$key]));
       }
       elseif (array_key_exists($key, $alternatives)) {
         $this->assertContains($row[$key], $alternatives[$key]);
@@ -2968,8 +2993,9 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    * Test get preview function on export processor.
    *
    * @throws \CRM_Core_Exception
+   * @throws \CiviCRM_API3_Exception
    */
-  public function testExportGetPreview() {
+  public function testExportGetPreview(): void {
     $this->setUpContactExportData();
     $fields = [
       ['contact_type' => 'Individual', 'name' => 'first_name'],
@@ -3007,8 +3033,9 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    * Set up contacts which will be merged with the same address option.
    *
    * @throws \CRM_Core_Exception
+   * @throws \CiviCRM_API3_Exception
    */
-  protected function setUpContactSameAddressExportData() {
+  protected function setUpContactSameAddressExportData(): void {
     $this->setUpContactExportData();
     $this->contactIDs[] = $contact3 = $this->individualCreate(['first_name' => 'Sarah', 'last_name' => 'Smith', 'prefix_id' => 'Dr.']);
     // Create address for contact A.
@@ -3028,7 +3055,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
    * Test for single select Autocomplete custom field.
    *
    */
-  public function testSingleAndMultiSelectAutoComplete() {
+  public function testSingleAndMultiSelectAutoComplete(): void {
     $customGroupId = $this->customGroupCreate([
       'extends' => 'Individual',
     ])['id'];
index fc185355f3ba01397b9d0aa858c91269943b5949..7c25f65c5a8ad2932aea42c5197e2cb30a25dc7d 100644 (file)
@@ -10,7 +10,7 @@ class CRM_Extension_BrowserTest extends CiviUnitTestCase {
     parent::setUp();
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     parent::tearDown();
   }
 
index 9efe4560552d6dc7ae32d3a75c6f044b2458f183..fd911ed703d789c22d2dd63f79a1fe5a2f7f6d82 100644 (file)
@@ -10,7 +10,7 @@ class CRM_Extension_Container_BasicTest extends CiviUnitTestCase {
     parent::setUp();
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     parent::tearDown();
   }
 
index 0fadefdb053395098ab7947eefca704581b0c7c6..bc9d419d434b8bd60c5f365b79f197e6ccd7cfcc 100644 (file)
@@ -19,7 +19,7 @@ class CRM_Extension_Container_CollectionTest extends CiviUnitTestCase {
     parent::setUp();
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     parent::tearDown();
   }
 
index 6a5a6835c1d82674c144024eb4720849f997dc34..9e5f1209d854bb2dfea08b2b31b45e4ad5bd663f 100644 (file)
@@ -10,7 +10,7 @@ class CRM_Extension_Container_StaticTest extends CiviUnitTestCase {
     parent::setUp();
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     parent::tearDown();
   }
 
index 77b46076aca5b5a13dcb8c87e0239b481476e283..75e082a73bdd9bd7e78c970c070bac9e79d6e2e5 100644 (file)
@@ -11,7 +11,7 @@ class CRM_Extension_InfoTest extends CiviUnitTestCase {
     $this->file = NULL;
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     if ($this->file) {
       unlink($this->file);
     }
@@ -55,7 +55,10 @@ class CRM_Extension_InfoTest extends CiviUnitTestCase {
 
   public function testGood_string_extras() {
     $data = "<extension key='test.bar' type='module'><file>testbar</file>
-      <classloader><psr4 prefix=\"Civi\\\" path=\"Civi\"/></classloader>
+      <classloader>
+        <psr4 prefix=\"Civi\\\" path=\"Civi\"/>
+        <psr0 prefix=\"CRM_\" path=\"\"/>
+      </classloader>
       <requires><ext>org.civicrm.a</ext><ext>org.civicrm.b</ext></requires>
     </extension>
     ";
@@ -65,6 +68,10 @@ class CRM_Extension_InfoTest extends CiviUnitTestCase {
     $this->assertEquals('testbar', $info->file);
     $this->assertEquals('Civi\\', $info->classloader[0]['prefix']);
     $this->assertEquals('Civi', $info->classloader[0]['path']);
+    $this->assertEquals('psr4', $info->classloader[0]['type']);
+    $this->assertEquals('CRM_', $info->classloader[1]['prefix']);
+    $this->assertEquals('', $info->classloader[1]['path']);
+    $this->assertEquals('psr0', $info->classloader[1]['type']);
     $this->assertEquals(['org.civicrm.a', 'org.civicrm.b'], $info->requires);
   }
 
index f9a587d806b28edca952bdc4f0ff696ecb58ab7a..53e12840c40a53ecc0b65a9a5ef82f9163bf0eed 100644 (file)
@@ -6,7 +6,7 @@
  */
 class CRM_Extension_Manager_ModuleTest extends CiviUnitTestCase {
 
-  public function setUp() {
+  public function setUp():void {
     parent::setUp();
     // $query = "INSERT INTO civicrm_domain ( name, version ) VALUES ( 'domain', 3 )";
     // $result = CRM_Core_DAO::executeQuery($query);
@@ -20,7 +20,7 @@ class CRM_Extension_Manager_ModuleTest extends CiviUnitTestCase {
     $this->setExtensionSystem($this->system);
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     parent::tearDown();
     $this->system = NULL;
   }
index a4b7d947d2d81a9e5cb885a952b0445930d2958d..d6bffc10e002b5296f28245c0d4a7acda436f15d 100644 (file)
@@ -27,7 +27,7 @@ class CRM_Extension_Manager_PaymentTest extends CiviUnitTestCase {
     $this->quickCleanup(['civicrm_payment_processor']);
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     parent::tearDown();
     $this->system = NULL;
     $this->quickCleanup(['civicrm_payment_processor']);
index 110b505ce99b25f91743348e5931e4eae62ffbcb..be7029c65ff64dc0d1a80017ddfc6c8f1b83139a 100644 (file)
@@ -6,7 +6,7 @@
  */
 class CRM_Extension_Manager_ReportTest extends CiviUnitTestCase {
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     //if (class_exists('test_extension_manager_reporttest')) {
     //  test_extension_manager_reporttest::$counts = array();
@@ -17,10 +17,6 @@ class CRM_Extension_Manager_ReportTest extends CiviUnitTestCase {
     ]);
   }
 
-  public function tearDown() {
-    parent::tearDown();
-  }
-
   /**
    * Install an extension with a valid type name.
    */
index 1f4e5964c8154a76883473d8b10fa303961195d0..ee4ec46433983366eedee6304807c64c9f5dff6a 100644 (file)
@@ -17,7 +17,7 @@ class CRM_Extension_Manager_SearchTest extends CiviUnitTestCase {
     ]);
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     parent::tearDown();
     $this->system = NULL;
   }
index 52396f41ba57626a28d2c160c8adccf604723fb8..ea1c71a53baa025a035a6eb7c1b7cf1624c381fa 100644 (file)
@@ -17,16 +17,12 @@ class CRM_Extension_ManagerTest extends CiviUnitTestCase {
   const TESTING_TYPE = 'report';
   const OTHER_TESTING_TYPE = 'module';
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     list ($this->basedir, $this->container) = $this->_createContainer();
     $this->mapper = new CRM_Extension_Mapper($this->container);
   }
 
-  public function tearDown() {
-    parent::tearDown();
-  }
-
   /**
    * Install an extension with an invalid type name.
    *
index da9ba2c61eaf497f6765b56375bd344198a55187..1f7a955c3e56972ff28a74fb149b53ec8e20e073 100644 (file)
@@ -36,7 +36,7 @@ class CRM_Extension_MapperTest extends CiviUnitTestCase {
    */
   protected $mapperWithSlash;
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     list ($this->basedir, $this->container) = $this->_createContainer();
     $this->mapper = new CRM_Extension_Mapper($this->container);
@@ -45,10 +45,6 @@ class CRM_Extension_MapperTest extends CiviUnitTestCase {
     $this->mapperWithSlash = new CRM_Extension_Mapper($this->containerWithSlash);
   }
 
-  public function tearDown() {
-    parent::tearDown();
-  }
-
   public function testClassToKey() {
     $this->assertEquals("test.foo.bar", $this->mapper->classToKey('test_foo_bar'));
   }
index 7be8734bbbcd84237cfcfbdb4a6f7f56445b59f4..0d016f900714e18dafc1cffbaaa6125d3a5595d9 100644 (file)
@@ -22,7 +22,7 @@ class CRM_Financial_BAO_FinancialItemTest extends CiviUnitTestCase {
   /**
    * Clean up after each test.
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanUpFinancialEntities();
     parent::tearDown();
   }
index 5bb226dff488feb8c86928d95cc3043e9efdeb05..a2d0b4a451a462c8a73f8533aac90e1c65b3c539 100644 (file)
@@ -20,7 +20,7 @@ class CRM_Financial_BAO_FinancialTypeTest extends CiviUnitTestCase {
     $this->_orgContactID = $this->organizationCreate();
   }
 
-  public function teardown() {
+  public function tearDown(): void {
     global $dbLocale;
     if ($dbLocale) {
       CRM_Core_I18n_Schema::makeSinglelingual('en_US');
index c300732d54fb3e0936ee797dc0b83bf56d60ff9c..88119ae5b10fdf793c3e7adb6f3a35cf3e8834e2 100644 (file)
@@ -19,7 +19,7 @@ class CRM_Financial_Form_PaymentEditTest extends CiviUnitTestCase {
   /**
    * Setup function.
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->createLoggedInUser();
 
@@ -31,7 +31,7 @@ class CRM_Financial_Form_PaymentEditTest extends CiviUnitTestCase {
    *
    * @throws \CRM_Core_Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanUpFinancialEntities();
     $this->quickCleanup(['civicrm_note', 'civicrm_uf_match', 'civicrm_address']);
   }
index 6eb09d8bb125671efa024ece393a6fdda906a0aa..5237cf2bfc5ce48235349c897d3948c175fcc15d 100644 (file)
@@ -51,7 +51,7 @@ class CRM_Group_Page_AjaxTest extends CiviUnitTestCase {
     $this->groupCreate(['title' => 'not-me-active', 'is_active' => 1, 'name' => 'not-me-active']);
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     CRM_Utils_Hook::singleton()->reset();
     $this->quickCleanup(['civicrm_group']);
     $config = CRM_Core_Config::singleton();
index 562450aaa4d96dfcbe5539ea3428422f2bc6e638..c2623dd7e113223c1f12c038a744898e42693265 100644 (file)
@@ -10,7 +10,7 @@ class CRM_Logging_LoggingTest extends CiviUnitTestCase {
     parent::setUp();
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     CRM_Core_I18n_Schema::makeSinglelingual('en_US');
     $logging = new CRM_Logging_Schema();
     $logging->dropAllLogTables();
index 5b4c3ebe4cdf76ccb45265ee52d2e6d93b1b64af..110c6ffcc2a01b6e7fedb46cece679e61110c5f9 100644 (file)
@@ -18,7 +18,7 @@ class CRM_Logging_SchemaTest extends CiviUnitTestCase {
    *
    * @throws \CRM_Core_Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $schema = new CRM_Logging_Schema();
     $schema->disableLogging();
     $this->databaseVersion = NULL;
index acf200c46615a092b0311d7bac98c0006936e8ff..69b039002d77eaa298ebec632b8b5ce5c1bba4c0 100644 (file)
@@ -20,7 +20,7 @@ class CRM_Mailing_BAO_MailingTest extends CiviUnitTestCase {
     parent::setUp();
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     global $dbLocale;
     if ($dbLocale) {
       CRM_Core_I18n_Schema::makeSinglelingual('en_US');
index f5fcd8292cc26298def1f4cc84762e89f67137e2..218753b795d541c75f5dc4845447472d14c5af04 100644 (file)
@@ -17,7 +17,7 @@ class CRM_Mailing_BAO_QueryTest extends CiviUnitTestCase {
     parent::setUp();
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     $tablesToTruncate = [
       'civicrm_mailing_event_bounce',
       'civicrm_mailing_event_delivered',
index b23abe5aef05e15bef1183d247caae7d9c3e3f29..ae5be6bf09ce6f5cf4264bdd1e4e0cd02b3680a6 100644 (file)
@@ -19,7 +19,7 @@ class CRM_Mailing_BAO_SpoolTest extends CiviUnitTestCase {
     $this->_mut = new CiviMailUtils($this, TRUE);
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     $this->_mut->stop();
     parent::tearDown();
   }
index 87670df9ff48505d3d7d8bee8493c0714f7fbaa3..f83d444e48d8c60148664c633edbef01ac617dd7 100644 (file)
@@ -57,7 +57,7 @@ abstract class CRM_Mailing_BaseMailingSystemTest extends CiviUnitTestCase {
 
   /**
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->_mut->stop();
     CRM_Utils_Hook::singleton()->reset();
     // DGW
index ba982b9d3542f526d3a532ced6dcd17e3f91591b..e4a549ff8ca68959b596549d1b7724d97ff80904 100644 (file)
@@ -14,7 +14,7 @@ class CRM_Mailing_MailStoreTest extends \CiviUnitTestCase {
     @unlink($this->workDir);
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     parent::tearDown();
     if (is_dir($this->workDir)) {
       CRM_Utils_File::cleanDir($this->workDir);
index b1846cee7eea0c572106079a4e193aa39d5852ab..d80982020ec50ae0c12acddb7042079abfcad5fb 100644 (file)
@@ -55,7 +55,7 @@ class CRM_Mailing_MailingSystemTest extends CRM_Mailing_BaseMailingSystemTest {
     $this->assertEquals('civimail', $context);
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     global $dbLocale;
     if ($dbLocale) {
       CRM_Core_I18n_Schema::makeSinglelingual('en_US');
index 9322190ad90f174e05c939f91012fc8f05ff42e1..541b1d0cf45f37cede11d68a6ecb6880bfd1228d 100644 (file)
@@ -101,7 +101,7 @@ class CRM_Member_BAO_MembershipLogTest extends CiviUnitTestCase {
    *
    * @throws \CRM_Core_Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->relationshipTypeDelete($this->relationshipTypeID);
     $this->quickCleanUpFinancialEntities();
     $this->restoreMembershipTypes();
index f413ffd22b7c4dba4b5078cda9b6cd1795bdfcd6..156b40ed7d74e7eb060cd40fda4528984ea6eb5c 100644 (file)
@@ -15,7 +15,7 @@
  */
 class CRM_Member_BAO_MembershipStatusTest extends CiviUnitTestCase {
 
-  protected function tearDown() {
+  protected function tearDown(): void {
     foreach ($this->ids as $entity => $ids) {
       foreach ($ids as $id) {
         $this->callAPISuccess($entity, 'Delete', ['id' => $id]);
index 83c6bbbc3d95fe31ea75cc3cd23b83547b0ab0bd..ad5c9a1b0961f73cd98f4c12a18e501db9b64974 100644 (file)
@@ -34,7 +34,7 @@ class CRM_Member_BAO_MembershipTest extends CiviUnitTestCase {
    *
    * @throws \CRM_Core_Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->membershipTypeDelete(['id' => $this->_membershipTypeID]);
     $this->membershipStatusDelete($this->_membershipStatusID);
     $this->contactDelete($this->_contactID);
index c7d855562d4ecddef2452f6621bdeeb957e10b17..0193316765d44168fdce6ee1660d71b4b1c7e914 100644 (file)
@@ -40,7 +40,7 @@ class CRM_Member_BAO_MembershipTypeTest extends CiviUnitTestCase {
    * Tears down the fixture, for example, closes a network connection.
    * This method is called after a test is executed.
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->relationshipTypeDelete($this->_relationshipTypeId);
     $this->membershipStatusDelete($this->_membershipStatusID);
     $this->contactDelete($this->_orgContactID);
index 29cfe5057baa97890bc149c2394f526cf01a808e..c85d66598e4fb96157854b0eb42f52c029184c95 100644 (file)
@@ -157,7 +157,7 @@ class CRM_Member_Form_MembershipTest extends CiviUnitTestCase {
    *
    * @throws \CRM_Core_Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanUpFinancialEntities();
     $this->quickCleanup(
       [
@@ -491,7 +491,6 @@ class CRM_Member_Form_MembershipTest extends CiviUnitTestCase {
     CRM_Core_Session::singleton()->getStatus(TRUE);
     $this->setCurrencySeparators($thousandSeparator);
     $form = $this->getForm();
-    $form->preProcess();
     $this->mut = new CiviMailUtils($this, TRUE);
     $form->_mode = 'test';
     $this->createLoggedInUser();
@@ -591,7 +590,6 @@ class CRM_Member_Form_MembershipTest extends CiviUnitTestCase {
   public function testContributionUpdateOnMembershipTypeChange(): void {
     // Step 1: Create a Membership via backoffice whose with 50.00 payment
     $form = $this->getForm();
-    $form->preProcess();
     $this->mut = new CiviMailUtils($this, TRUE);
     $this->createLoggedInUser();
     $priceSet = $this->callAPISuccess('PriceSet', 'Get', ["extends" => "CiviMember"]);
index ce464ce4973dc546c45548c51c54e8c2d8e525c0..6a867170f8aee6197d321603d71f4bba8a7cf50a 100644 (file)
@@ -23,7 +23,7 @@ class CRM_Member_Form_Task_BatchTest extends CiviUnitTestCase {
    *
    * @throws \CRM_Core_Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->validateAllContributions();
     $this->validateAllPayments();
     $this->quickCleanUpFinancialEntities();
index cd9e2ee6e5dd540b0ace1c627bcd266e0cb54737..a2d14a194217a5dddcaf21941508eace7df457da 100644 (file)
@@ -19,7 +19,7 @@ class CRM_Member_Form_Task_PDFLetterCommonTest extends CiviUnitTestCase {
   /**
    * Clean up after each test.
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanUpFinancialEntities();
     CRM_Utils_Hook::singleton()->reset();
   }
index 59de09c1ce9f2f2847ed6f25939f4cc4d51d0536..8fd040a7b464a20fa9c4c17d813906f55d57dfb4 100644 (file)
@@ -96,7 +96,7 @@ class CRM_Member_Import_Parser_MembershipTest extends CiviUnitTestCase {
    *
    * @throws \CRM_Core_Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $tablesToTruncate = [
       'civicrm_membership',
       'civicrm_membership_log',
index 267b33d5db133676eebae0fa3bd779968d27d795..798647f46723fab45d0630d2c3bc696fb8a43f2e 100644 (file)
@@ -24,7 +24,7 @@ class CRM_PCP_BAO_PCPTest extends CiviUnitTestCase {
    *
    * @throws \CRM_Core_Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanUpFinancialEntities();
     parent::tearDown();
   }
index 6832bb8965c2a39502e1edf6a1d45b17f04f8d04..6144b7558d81433b9fd31d6571cab76f9eeb3efd 100644 (file)
@@ -21,19 +21,12 @@ class CRM_Pledge_BAO_PledgeBlockTest extends CiviUnitTestCase {
    * Sets up the fixture, for example, opens a network connection.
    * This method is called before a test is executed.
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     $contributionPage = $this->contributionPageCreate();
     $this->_contributionPageId = $contributionPage['id'];
   }
 
-  /**
-   * Tears down the fixture, for example, closes a network connection.
-   * This method is called after a test is executed.
-   */
-  protected function tearDown() {
-  }
-
   /**
    *  create() and deletepledgeblock() method
    */
index 811ae2614498a4653ba74b322ea043e92ff51036..a5413a0288dd3c6c3c3c3339dd064a95d19f0303 100644 (file)
  */
 class CRM_Pledge_BAO_PledgePaymentTest extends CiviUnitTestCase {
 
-  /**
-   * Sets up the fixture, for example, opens a network connection.
-   * This method is called before a test is executed.
-   */
-  protected function setUp() {
-    parent::setUp();
-  }
-
-  /**
-   * Tears down the fixture, for example, closes a network connection.
-   * This method is called after a test is executed.
-   */
-  protected function tearDown() {
-  }
-
   /**
    *  Test for Add/Update Pledge Payment.
    */
index 536f24afadf5f8caf0397a3ab47c55cf21928a04..182ee91b7c2e0712f3302c75d7ed4f62afa4af9c 100644 (file)
@@ -23,7 +23,7 @@ class CRM_Pledge_BAO_PledgeTest extends CiviUnitTestCase {
    *
    * @throws \CiviCRM_API3_Exception
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     $this->ids['Contact'][0] = $this->individualCreate();
     $this->_params = [
@@ -43,13 +43,6 @@ class CRM_Pledge_BAO_PledgeTest extends CiviUnitTestCase {
     ];
   }
 
-  /**
-   * Tears down the fixture, for example, closes a network connection.
-   * This method is called after a test is executed.
-   */
-  protected function tearDown() {
-  }
-
   /**
    *  Test for Add/Update Pledge.
    *
index d8bba2d71ce46ff514d366fe41746aad804e69c8..0ff0e7750ebd55e4b84f3d6b8b7192094ec8c73c 100644 (file)
@@ -12,7 +12,7 @@ class CRM_Pledge_Form_SearchTest extends CiviUnitTestCase {
     $this->pledgeCreate(['contact_id' => $this->individualID]);
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     parent::tearDown();
     $tablesToTruncate = [
       'civicrm_activity',
index 23261b4c66bfc491b71ef46b0fe9988d4c79e961..d229b86a00a77431ed847baf5c8ca049a74f9e77 100644 (file)
  */
 class CRM_Price_BAO_PriceFieldValueTest extends CiviUnitTestCase {
 
-  /**
-   * Sets up the fixtures.
-   */
-  protected function setUp() {
-    parent::setUp();
-  }
-
-  /**
-   * Tears down the fixture.
-   */
-  protected function tearDown() {
-  }
-
   /**
    * Verifies visibility field exists and is configured as a pseudoconstant
    * referencing the 'visibility' option group.
index 36e1e19285cce230bcf428170f797129af13de29..c0c93e1aaa13c7b327da34ec47f0ff10d4498dfc 100644 (file)
  */
 class CRM_Price_BAO_PriceSetTest extends CiviUnitTestCase {
 
-  /**
-   * Sets up the fixtures.
-   */
-  protected function setUp() {
-    parent::setUp();
-  }
-
-  /**
-   * Tears down the fixture.
-   */
-  protected function tearDown() {
-  }
-
   /**
    * Test the correct amount level is returned for an event which is not presented as a price set event.
    *
index 559f2b5b997b0b04f31a454485c01b9422a60810..c7a4dccad490f65cb94c62177eabd9f934abb58e 100644 (file)
@@ -44,7 +44,7 @@ class CRM_Queue_Queue_SqlTest extends CiviUnitTestCase {
     $this->queueService = CRM_Queue_Service::singleton(TRUE);
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     CRM_Utils_Time::resetTime();
 
     $tablesToTruncate = ['civicrm_queue_item'];
index 6578645299aca9c54dac94c81889922d05d78699..8b114d402caf07217c4d5476fb9d959357d0a2fb 100644 (file)
@@ -47,7 +47,7 @@ class CRM_Queue_QueueTest extends CiviUnitTestCase {
     $this->queueService = CRM_Queue_Service::singleton(TRUE);
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     CRM_Utils_Time::resetTime();
 
     $tablesToTruncate = ['civicrm_queue_item'];
index f82d2c79c86b3c00dde5aafbf97a2cb9fde8eb66..f8dde4382ee83ee90aa04d4de4bde7baf0899264 100644 (file)
@@ -25,7 +25,7 @@ class CRM_Queue_RunnerTest extends CiviUnitTestCase {
     self::$_recordedValues = [];
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     unset($this->queue);
     unset($this->queueService);
 
index ae2ba0119ed95fea7ba3b82ee4572c6facc1f06e..97848fa4e1c0801002fda26e2cbc457451e386a3 100644 (file)
@@ -28,7 +28,7 @@ class CRM_Report_Form_ActivityTest extends CiviReportTestCase {
     $this->quickCleanup($this->_tablesToTruncate);
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     parent::tearDown();
     CRM_Core_DAO::executeQuery('DROP TEMPORARY TABLE IF EXISTS civireport_activity_temp_target');
   }
index 47f269e43b8b001f4d6ba7293cafc81ffa252533..83cc4cf686daebc7115d999ff8236304daefe6c2 100644 (file)
@@ -22,15 +22,11 @@ class CRM_Report_Form_ContactSummaryTest extends CiviReportTestCase {
     'civicrm_address',
   ];
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->quickCleanup($this->_tablesToTruncate);
   }
 
-  public function tearDown() {
-    parent::tearDown();
-  }
-
   /**
    * Ensure the new Odd/Event street number sort column works correctly
    */
index 8ce39c5b99f6704c8f8cdbc0a5990b27216333e0..a7712723d257714a7b8c7f1bfd78a9dd26421da0 100644 (file)
  */
 class CRM_Report_FormTest extends CiviUnitTestCase {
 
-  public function setUp() {
-    // There are only unit tests here at present, we can skip database loading.
-    return TRUE;
-  }
-
-  public function tearDown() {
-    // There are only unit tests here at present, we can skip database loading.
-    return TRUE;
-  }
-
   /**
    * Used by testGetFromTo
    */
index 17a61c2feadbd8cd7861ac52d19cd4197e01c4f5..105193a2909b6990d3d0ff2832c3ff077f2dd3bc 100644 (file)
@@ -30,7 +30,7 @@ class CRM_SMS_BAO_ProviderTest extends CiviUnitTestCase {
   /**
    * Clean up after each test.
    */
-  public function tearDown() {
+  public function tearDown(): void {
     parent::tearDown();
     $this->callAPISuccess('option_value', 'delete', ['id' => $this->option_value]);
   }
index dfe82711c3f427e2dc13226473a1eeb246ef493e..ce45dfa728a2a0f261f389ef3e170e9f77cb36ce 100644 (file)
@@ -19,7 +19,7 @@ class CRM_SMS_PreviewTest extends CiviUnitTestCase {
   /**
    * Clean up after each test.
    */
-  public function tearDown() {
+  public function tearDown(): void {
     parent::tearDown();
     $this->callAPISuccess('option_value', 'delete', ['id' => $this->option_value]);
   }
index 877b2f9a4918e60ed3d6b6daf5a08a180e3ff89f..a1921f330b90a8208282478d0a783398785d45ad 100644 (file)
@@ -32,7 +32,7 @@ class CRM_SMS_ProviderTest extends CiviUnitTestCase {
   /**
    * Clean up after each test.
    */
-  public function tearDown() {
+  public function tearDown(): void {
     parent::tearDown();
     $this->quickCleanup(['civicrm_email', 'civicrm_phone', 'civicrm_activity', 'civicrm_activity_contact']);
     $this->callAPISuccess('option_value', 'delete', ['id' => $this->option_value]);
index c9a030bbd51654205970bc6bf39f731e68826240..4eb202e778581a4968dfebab54891b127fb431ec 100644 (file)
@@ -7,7 +7,7 @@
 class CRM_Upgrade_Incremental_BaseTest extends CiviUnitTestCase {
   use CRMTraits_Custom_CustomDataTrait;
 
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanup(['civicrm_saved_search']);
   }
 
index 14aa68c27f20fb18acbf84933fd92aa7240f29da..f222e46a0cc94feb1cfaef0735597a4b2bbd71ad 100644 (file)
@@ -7,10 +7,6 @@ require_once 'CiviTest/CiviCaseTestCase.php';
  */
 class CRM_Upgrade_Incremental_php_FiveTwentyTest extends CiviCaseTestCase {
 
-  public function setUp() {
-    parent::setUp();
-  }
-
   /**
    * Test that the upgrade task changes the direction but only
    * for bidirectional relationship types that are b_a.
index aa4282606573192e50cbb834e5508515513ef14e..be36950452a1c2574b0ae9cb526c355d77a84b43 100644 (file)
@@ -27,7 +27,7 @@ class CRM_Utils_API_MatchOptionTest extends CiviUnitTestCase {
     ]);
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     $noise = $this->callAPISuccess('Contact', 'get', [
       'id' => $this->noise['individual'],
       'return' => ['email'],
index 68d1ac325032bf4368bc68c52d35f0b685c461ea..2bfdcae2456eb000e5001438f74dce1377d467b0 100644 (file)
@@ -6,14 +6,6 @@
  */
 class CRM_Utils_Cache_SqlGroupTest extends CiviUnitTestCase {
 
-  public function setUp() {
-    parent::setUp();
-  }
-
-  public function tearDown() {
-    parent::tearDown();
-  }
-
   /**
    * Add and remove two items from the same cache instance.
    */
index 65afb0384ae432b52adf981f29b97956293ed82f..ac73ae3bb6eca0e51f79137b0a0c6a6bf8805781 100644 (file)
  */
 class CRM_Utils_DateTest extends CiviUnitTestCase {
 
-  public function setUp() {
-    // There are only unit tests here at present, we can skip database loading.
-    return TRUE;
-  }
-
-  public function tearDown() {
-    // There are only unit tests here at present, we can skip database loading.
-    return TRUE;
-  }
-
   /**
    * Used by testGetFromTo
    */
index 6924840b6c74b13c61352eec008166f3d96d2ae8..97419e2511b353bc4b1504141733ff6f809cddfd 100644 (file)
@@ -27,7 +27,7 @@ class CRM_Utils_HookTest extends CiviUnitTestCase {
     self::$activeTest = $this;
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     self::$activeTest = $this;
     parent::tearDown();
   }
index 39ca92d8cb6a1a39edcdcf31c9e075255e82a74b..1ec1a6eadedc9fde2d3a1863b809cb6b75f925c8 100644 (file)
@@ -37,7 +37,7 @@ class CRM_Utils_HttpClientTest extends CiviUnitTestCase {
     $this->client = new CRM_Utils_HttpClient();
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     CRM_Core_DAO::executeQuery("DELETE FROM civicrm_setting WHERE name = 'verifySSL'");
     CRM_Core_Config::singleton(TRUE);
     parent::tearDown();
index c461e0543df7046f61b3146a44f728508da36c42..b845c3620fdafd754cca7c01d3c9065cd42a2aef 100644 (file)
@@ -30,7 +30,7 @@ class CRM_Utils_Mail_EmailProcessorInboundTest extends CiviUnitTestCase {
     ])['id'];
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     CRM_Utils_File::cleanDir(__DIR__ . '/data/mail');
     $this->callAPISuccess('MailSettings', 'delete', [
       'id' => $this->mailSettingsId,
index b675125b75616d2285dd4f4d6250b6e50766d48b..e0468acf305d715adf0fee2c647b9c3fe0c9c3f8 100644 (file)
@@ -34,7 +34,7 @@ class CRM_Utils_Mail_EmailProcessorTest extends CiviUnitTestCase {
     ]);
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     CRM_Utils_File::cleanDir(__DIR__ . '/data/mail');
     parent::tearDown();
     $this->quickCleanup([
index 423aa365256c9d7bdc1d292cbf935012f2731583..d72b5579095cab69083bfb57e8f87937caae4f57 100644 (file)
@@ -5,14 +5,8 @@
  * @group headless
  */
 class CRM_Utils_Migrate_ImportExportTest extends CiviUnitTestCase {
-  protected $_apiversion;
 
-  public function setUp() {
-    $this->_apiversion = 3;
-    parent::setUp();
-  }
-
-  public function tearDown() {
+  public function tearDown(): void {
     $tablesToTruncate = [
       'civicrm_custom_group',
       'civicrm_custom_field',
index b32d64e5bdb49d25eb872a9e967f6557b65e030a..eb41fbfb771a0c9ab410ea27f3b0e8817dba146b 100644 (file)
@@ -20,7 +20,7 @@ class CRM_Utils_ZipTest extends CiviUnitTestCase {
     $this->file = FALSE;
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     parent::tearDown();
     if ($this->file) {
       unlink($this->file);
index b8cdb51bf1a425858e399ed6c9131e6ff2808823..09292b514ba0989be49de95aa498e2e47c595aa7 100644 (file)
@@ -8,10 +8,6 @@ use Civi\Test\Invasive;
  */
 class CRM_Utils_versionCheckTest extends CiviUnitTestCase {
 
-  public function setUp() {
-    parent::setUp();
-  }
-
   /**
    * @var array
    */
@@ -91,7 +87,7 @@ class CRM_Utils_versionCheckTest extends CiviUnitTestCase {
     ],
   ];
 
-  public function tearDown() {
+  public function tearDown(): void {
     parent::tearDown();
     $vc = new CRM_Utils_VersionCheck();
     if (file_exists($vc->cacheFile)) {
index 1d3afb246e088bb509f1c1c2e95a2103070d1556..88759ebc45628e090e9cd60220f699a18871cee0 100644 (file)
@@ -9,7 +9,7 @@ namespace Civi\CCase;
  */
 class SequenceListenerTest extends \CiviCaseTestCase {
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->_params = [
       'case_type' => $this->caseType,
index 76dbc4bdbe42200cfbe4bd9a2b6816209eea75d1..1fcae645d3bc0e3faa87fba6d28d536348881b09 100644 (file)
@@ -14,7 +14,7 @@ class CiviFacadeTest extends \CiviUnitTestCase {
     $this->mandates = [];
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     $GLOBALS['civicrm_setting'] = $this->origSetting;
     parent::tearDown();
   }
index 34bc465104d221c1212f5b46e68e7d335bc94e54..3ae516c552f41775c8b01838953eea41c9bb5f2f 100644 (file)
@@ -3,7 +3,7 @@ namespace Civi\Core\Event;
 
 class GenericHookEventTest extends \CiviUnitTestCase {
 
-  public function tearDown() {
+  public function tearDown(): void {
     \CRM_Utils_Hook::singleton()->reset();
     parent::tearDown();
   }
index 6271337b29c090d63fca864c992ec3fa863d2342..e68ac6f29e2b2e3b86db98b812a33a31554a693f 100644 (file)
@@ -14,7 +14,7 @@ class SettingsBagTest extends \CiviUnitTestCase {
     $this->mandates = [];
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     $GLOBALS['civicrm_setting'] = $this->origSetting;
     parent::tearDown();
   }
index 71be2b80a77942fd2428830064b38a878dba3097..77b99ad115c139d26631ef9aeab3d5346000dcdc 100644 (file)
@@ -38,7 +38,7 @@ class SettingsManagerTest extends \CiviUnitTestCase {
     ];
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     $GLOBALS['civicrm_setting'] = $this->origSetting;
     parent::tearDown();
   }
index ac4cee90567b7c3668cc4ff06eba54da3caeabe4..258c68d20e167e09f823d9a20f9d1b7a84f91981 100644 (file)
@@ -3,15 +3,11 @@ namespace Civi\Core;
 
 class SettingsStackTest extends \CiviUnitTestCase {
 
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     $this->useTransaction(TRUE);
   }
 
-  public function tearDown() {
-    parent::tearDown();
-  }
-
   /**
    * Temporarily modify -- then restore -- settings.
    */
index fb81845ccb57923701b8551e41860fc7025bbb7e..b84d80ceac972881f43d903583e28563e0993b03 100644 (file)
@@ -19,7 +19,7 @@ class ExampleHookTest extends \PHPUnit\Framework\TestCase implements HeadlessInt
     return \Civi\Test::headless()->apply();
   }
 
-  protected function setUp() {
+  protected function setUp(): void {
     $this->contact = \CRM_Core_DAO::createTestObject('CRM_Contact_DAO_Contact', [
       'contact_type' => 'Individual',
     ]);
@@ -27,7 +27,7 @@ class ExampleHookTest extends \PHPUnit\Framework\TestCase implements HeadlessInt
     $session->set('userID', $this->contact->id);
   }
 
-  protected function tearDown() {
+  protected function tearDown(): void {
     $this->contact->delete();
   }
 
index 17a93264e9c677441c7b219a23e221df7141c9c7..b147434aeab632490ef156f4402976246595a75a 100644 (file)
@@ -21,7 +21,7 @@ class ExampleTransactionalTest extends \PHPUnit\Framework\TestCase implements He
     return \Civi\Test::headless()->apply();
   }
 
-  protected function setUp() {
+  protected function setUp(): void {
     /** @var \CRM_Contact_DAO_Contact $contact */
     $contact = \CRM_Core_DAO::createTestObject('CRM_Contact_DAO_Contact', [
       'contact_type' => 'Individual',
@@ -60,9 +60,6 @@ class ExampleTransactionalTest extends \PHPUnit\Framework\TestCase implements He
     $this->assertTrue((bool) $dao->find());
   }
 
-  public function tearDown() {
-  }
-
   /**
    * Both testDummy1 and testDummy2 have been created at some point (as part of the test runs),
    * but all the data was rolled-back
index 44b03ad3170fa4c522106aa72774b1270e9f8c99..f13ee024d47b97185a09504fe0bba1dececa4f34 100644 (file)
@@ -28,7 +28,7 @@ class CiviCaseTestCase extends CiviUnitTestCase {
 
   protected $_loggedInUser;
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
 
     // CRM-9404 - set-up is a bit cumbersome but had to put something in place to set up activity types & case types
@@ -110,7 +110,7 @@ class CiviCaseTestCase extends CiviUnitTestCase {
    * Tears down the fixture, for example, closes a network connection.
    * This method is called after a test is executed.
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanup($this->tablesToTruncate, TRUE);
     $this->customDirectories(array('template_path' => FALSE));
     CRM_Case_XMLRepository::singleton(TRUE);
index fca4ea43ad7ca7506b546d107325de60d93c7882..d3f1e4adfd6e215eaa76c033b1a6428eeca35bdb 100644 (file)
  */
 class CiviReportTestCase extends CiviUnitTestCase {
 
-  public function setUp() {
-    parent::setUp();
-    $this->_sethtmlGlobals();
-  }
-
-  public function tearDown() {
+  public function tearDown(): void {
     // TODO Figure out how to automatically drop all temporary tables.
     // Note that MySQL doesn't provide a way to list them, so we would need
     // to keep track ourselves (eg CRM_Core_TemporaryTableManager) or reset
index b063711737f94691f2769dcb2913662f05716e6a..8a78474af552e4e45113fc8149df7da70be7a045 100644 (file)
@@ -372,12 +372,13 @@ class CiviUnitTestCase extends PHPUnit\Framework\TestCase {
 
     $this->renameLabels();
     $this->_sethtmlGlobals();
+    $this->ensureMySQLMode(['IGNORE_SPACE', 'ERROR_FOR_DIVISION_BY_ZERO', 'STRICT_TRANS_TABLES']);
   }
 
   /**
    * Read everything from the datasets directory and insert into the db.
    */
-  public function loadAllFixtures() {
+  public function loadAllFixtures(): void {
     $fixturesDir = __DIR__ . '/../../fixtures';
 
     CRM_Core_DAO::executeQuery("SET FOREIGN_KEY_CHECKS = 0;");
@@ -461,7 +462,7 @@ class CiviUnitTestCase extends PHPUnit\Framework\TestCase {
   /**
    *  Common teardown functions for all unit tests.
    */
-  protected function tearDown() {
+  protected function tearDown(): void {
     $this->_apiversion = 3;
     $this->resetLabels();
 
@@ -3790,4 +3791,16 @@ WHERE a1.is_primary = 0
     '));
   }
 
+  /**
+   * Ensure the specified mysql mode/s are activated.
+   *
+   * @param array $modes
+   */
+  protected function ensureMySQLMode(array $modes): void {
+    $currentModes = array_fill_keys(CRM_Utils_SQL::getSqlModes(), 1);
+    $currentModes = array_merge($currentModes, array_fill_keys($modes, 1));
+    CRM_Core_DAO::executeQuery("SET GLOBAL sql_mode = '" . implode(',', array_keys($currentModes)) . "'");
+    CRM_Core_DAO::executeQuery("SET sql_mode = '" . implode(',', array_keys($currentModes)) . "'");
+  }
+
 }
index df3e8357b40b21cb0298e55dcab5ae5df8f070ae..a68900238ff3daa870adcaa308a139085bd678d7 100644 (file)
@@ -27,7 +27,7 @@ class E2E_Cache_TieredTest extends E2E_Cache_CacheTestCase {
    */
   protected $b;
 
-  protected function tearDown() {
+  protected function tearDown(): void {
     if (function_exists('timecop_return')) {
       timecop_return();
     }
index 875e692a0343c95017efd4564563b71c7cd13cec..73e9f554df594c82977b61119717b6953df7d58b 100644 (file)
@@ -31,7 +31,7 @@ class E2E_Cache_TwoInstancesTest extends CiviEndToEndTestCase {
     $this->a = $this->b = NULL;
   }
 
-  protected function tearDown() {
+  protected function tearDown(): void {
     parent::tearDown();
     if ($this->a) {
       $this->a->clear();
index 7d0d944429e6ef7e0cd91cfd519ff6f9a051b06d..fb598f6e7eb3ab809b51c764fe4ccf2a448d137f 100644 (file)
@@ -38,7 +38,7 @@ class PrevNextTest extends \CiviEndToEndTestCase {
     );
   }
 
-  protected function tearDown() {
+  protected function tearDown(): void {
     \Civi::service('prevnext')->deleteItem(NULL, $this->cacheKey);
     \Civi::service('prevnext')->deleteItem(NULL, $this->cacheKeyB);
   }
index 0117073647978c1e1c5b4c46a7f9d8fd6fce1358..db1bf239cbcfb44608b00a4ee0c8730a7f436359 100644 (file)
@@ -23,7 +23,7 @@
  */
 class E2E_Extern_CliRunnerTest extends CiviEndToEndTestCase {
 
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     foreach (['CIVI_CORE', 'CMS_ROOT', 'CMS_URL'] as $var) {
@@ -33,10 +33,6 @@ class E2E_Extern_CliRunnerTest extends CiviEndToEndTestCase {
     }
   }
 
-  protected function tearDown() {
-    parent::tearDown();
-  }
-
   /**
    * @return array
    *   Each case gives a name (eg "cv") and template for executing the command
index 22fbaedd3f450cdf0f141e3b0a6dc191faba2815..ed3aed7019bc43e969f97980483736212e38ad3e 100644 (file)
@@ -36,7 +36,7 @@ class E2E_Extern_RestTest extends CiviEndToEndTestCase {
     //$this->assertEquals($cmpvar, $apiResult['is_error'], $prefix . print_r($apiResult, TRUE));
   }
 
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     if (empty($GLOBALS['_CV']['CIVI_SITE_KEY'])) {
@@ -51,7 +51,7 @@ class E2E_Extern_RestTest extends CiviEndToEndTestCase {
       ->getUrl('civicrm', 'extern/rest.php');
   }
 
-  protected function tearDown() {
+  protected function tearDown(): void {
     if (!empty($this->old_api_keys)) {
       foreach ($this->old_api_keys as $cid => $apiKey) {
         civicrm_api3('Contact', 'create', array(
index be4674a0c09574215898ff846bedc9b74265d67e..d5e1154040cae95e06444bc56a6bced503b21d1c 100644 (file)
@@ -21,7 +21,7 @@ class api_v3_ACLCachingTest extends CiviUnitTestCase {
 
   public $DBResetRequired = FALSE;
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
   }
 
@@ -29,7 +29,7 @@ class api_v3_ACLCachingTest extends CiviUnitTestCase {
    * (non-PHPdoc)
    * @see CiviUnitTestCase::tearDown()
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $tablesToTruncate = [
       'civicrm_activity',
     ];
index f587ad13f991362359134a94aa822cfdd2322aab..61887fcabc7d59c5273f47fae6523d933560d93f 100644 (file)
@@ -28,7 +28,7 @@ class api_v3_ACLPermissionTest extends CiviUnitTestCase {
   public $DBResetRequired = FALSE;
   protected $_entity;
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     CRM_Core_DAO::createTestObject('CRM_Pledge_BAO_Pledge', [], 1, 0);
     $this->callAPISuccess('Phone', 'create', ['id' => $this->individualCreate(['email' => '']), 'phone' => '911', 'location_type_id' => 'Home']);
@@ -39,7 +39,7 @@ class api_v3_ACLPermissionTest extends CiviUnitTestCase {
    * (non-PHPdoc)
    * @see CiviUnitTestCase::tearDown()
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->cleanUpAfterACLs();
     $tablesToTruncate = [
       'civicrm_contact',
index 0d18b52106776443041072aca28f3ac9ede90cdb..2c0734927cf497f464abbd7042bd139d5d6401d3 100644 (file)
@@ -27,20 +27,12 @@ class api_v3_APIWrapperTest extends CiviUnitTestCase {
    * Sets up the fixture, for example, opens a network connection.
    * This method is called before a test is executed.
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     $this->useTransaction(TRUE);
     CRM_Utils_Hook_UnitTests::singleton()->setHook('civicrm_apiWrappers', [$this, 'onApiWrappers']);
   }
 
-  /**
-   * Tears down the fixture, for example, closes a network connection.
-   * This method is called after a test is executed.
-   */
-  protected function tearDown() {
-    parent::tearDown();
-  }
-
   /**
    * @param $apiWrappers
    * @param $apiRequest
index 8c3a4e1192f1ce483d233cb7b8a1054439cbc77d..28abe07070bd58959eaea4062d6404c41c150d22 100644 (file)
@@ -39,7 +39,7 @@ class api_v3_ActionScheduleTest extends CiviUnitTestCase {
   /**
    * Test setup for every test.
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->useTransaction(TRUE);
   }
index 4bba2e4a811f0dd91270c7d36f4776898dac24b6..81a9b4b42d42c3ab0998ddfafc860069533af026 100644 (file)
@@ -29,7 +29,7 @@ class api_v3_ActivityCaseTest extends CiviCaseTestCase {
    * Connect to the database, truncate the tables that will be used
    * and redirect stdin to a temporary file.
    */
-  public function setUp() {
+  public function setUp(): void {
     $this->_entity = 'case';
 
     parent::setUp();
index 73d690f32f2653fd8617287680afb3385591f66f..4f721843c4fd39e6e365891ab5d6b31a67c1a7f8 100644 (file)
@@ -23,7 +23,7 @@ class api_v3_ActivityContactTest extends CiviUnitTestCase {
   protected $_activityID;
   protected $_params;
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->useTransaction(TRUE);
 
index 2ab72b6b38aea61824e8943f3c8b99a76abda3ae..082f14271446d626b5dadd65d6d493bb9105f141 100644 (file)
@@ -59,7 +59,7 @@ class api_v3_ActivityTest extends CiviUnitTestCase {
    * Connect to the database, truncate the tables that will be used
    * and redirect stdin to a temporary file
    */
-  public function setUp() {
+  public function setUp(): void {
     // Connect to the database
     parent::setUp();
 
@@ -104,7 +104,7 @@ class api_v3_ActivityTest extends CiviUnitTestCase {
    *
    * This method is called after a test is executed.
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $tablesToTruncate = [
       'civicrm_contact',
       'civicrm_activity',
index 9fbf0bba9c92e1df7784d7cc24a01059d54cc54a..0af2b1ab3cc60370e5cb95306dbe0ff735d23abb 100644 (file)
@@ -34,7 +34,7 @@
 class api_v3_ActivityTypeTest extends CiviUnitTestCase {
   protected $_apiversion;
 
-  public function setUp() {
+  public function setUp(): void {
     $this->_apiversion = 3;
     CRM_Core_PseudoConstant::activityType(TRUE, TRUE, TRUE, 'name');
     parent::setUp();
index 5e5e89c61af5e4a08ceb65baf86e2ee1add63e4e..69817d4bfd12c23ec1d8027710ec62c84f7cebf7 100644 (file)
@@ -27,7 +27,7 @@ class api_v3_AddressTest extends CiviUnitTestCase {
 
   protected $_entity;
 
-  public function setUp() {
+  public function setUp(): void {
     $this->_entity = 'Address';
     parent::setUp();
 
@@ -48,7 +48,7 @@ class api_v3_AddressTest extends CiviUnitTestCase {
     ];
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     $this->locationTypeDelete($this->_locationTypeID);
     $this->contactDelete($this->_contactID);
     $this->quickCleanup(['civicrm_address', 'civicrm_relationship']);
index 346debc65509d94bf9ba77f2def6f1ec15f5bbf4..151b4de8f45933b09dd1788e72cfe47578b0fa05 100644 (file)
@@ -45,7 +45,7 @@ class api_v3_AttachmentTest extends CiviUnitTestCase {
     return self::$filePrefix;
   }
 
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     $this->useTransaction(TRUE);
 
@@ -53,7 +53,7 @@ class api_v3_AttachmentTest extends CiviUnitTestCase {
     file_put_contents($this->tmpFile('mytest.txt'), 'This comes from a file');
   }
 
-  protected function tearDown() {
+  protected function tearDown(): void {
     parent::tearDown();
     $this->cleanupFiles();
     \Civi::reset();
index 1fe43765849f85378c181ec1b5ce4795270f7838..457abcd2d6de22abafccd850d9f1aa1cb957608e 100644 (file)
@@ -25,7 +25,7 @@ class api_v3_BatchTest extends CiviUnitTestCase {
    *
    * This method is called before a test is executed.
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     $this->useTransaction(TRUE);
   }
index b83fcfaba0be69d28be0bddc58ad7443f1ea331f..e1a5a5b6ebd981fa20b81b0515df84b6c7817da7 100644 (file)
@@ -18,7 +18,7 @@ class api_v3_CRM11793Test extends CiviUnitTestCase {
    * Connect to the database, truncate the tables that will be used
    * and redirect stdin to a temporary file
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
 
     $this->individualCreate();
@@ -26,7 +26,7 @@ class api_v3_CRM11793Test extends CiviUnitTestCase {
     $this->organizationCreate();
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     parent::tearDown();
   }
 
index e7be69961514be48292e61ad0fe9d0fa10019419..7f324275068f106ffdd8691e18060d01fe1c69c5 100644 (file)
@@ -19,7 +19,7 @@ class api_v3_CampaignTest extends CiviUnitTestCase {
 
   public $DBResetRequired = FALSE;
 
-  public function setUp() {
+  public function setUp(): void {
     $this->params = [
       'title' => "campaign title",
       'description' => "Call people, ask for money",
index b65cf541e44d71b43f59c4e50363b656fbd69fb3..802bcdb30ab66a3bf8051a6b56ab67795cb5580f 100644 (file)
@@ -23,7 +23,7 @@ class api_v3_CaseContactTest extends CiviCaseTestCase {
    * Connect to the database, truncate the tables that will be used
    * and redirect stdin to a temporary file.
    */
-  public function setUp() {
+  public function setUp(): void {
     $this->_entity = 'case';
 
     parent::setUp();
index 9b5bb920d2eb0499cbe79c37ec7e5b9c7a9b9781..a172c07bedab1a93eaad7bd56f5574ddc3021627 100644 (file)
@@ -58,7 +58,7 @@ class api_v3_CaseTest extends CiviCaseTestCase {
    * Connect to the database, truncate the tables that will be used
    * and redirect stdin to a temporary file.
    */
-  public function setUp() {
+  public function setUp(): void {
     $this->_entity = 'case';
 
     parent::setUp();
@@ -80,7 +80,7 @@ class api_v3_CaseTest extends CiviCaseTestCase {
     $this->settingsStack = new \Civi\Core\SettingsStack();
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     $this->settingsStack->popAll();
     parent::tearDown();
   }
index 60392857617fac77340c76b5eca554155edebc81..5421b1f47ead01db4125b6325f991e5137b45b7b 100644 (file)
@@ -15,7 +15,7 @@
  */
 class api_v3_CaseTypeTest extends CiviCaseTestCase {
 
-  public function setUp() {
+  public function setUp(): void {
     $this->quickCleanup(['civicrm_case_type']);
     parent::setUp();
 
@@ -53,7 +53,7 @@ class api_v3_CaseTypeTest extends CiviCaseTestCase {
    *
    * This method is called after a test is executed.
    */
-  public function tearDown() {
+  public function tearDown(): void {
     parent::tearDown();
     $this->quickCleanup(['civicrm_case_type', 'civicrm_uf_match']);
   }
index cc000f719bfcfc1b0040c2946cf7219b34a20e5b..09aea87e611083edbea9c83dcb0b87d654cc66b5 100644 (file)
@@ -44,7 +44,7 @@ class api_v3_ConstantTest extends CiviUnitTestCase {
    * Connect to the database, truncate the tables that will be used
    * and redirect stdin to a temporary file
    */
-  public function setUp() {
+  public function setUp(): void {
     //  Connect to the database
     parent::setUp();
   }
index fa69185aca515c55f33eb358b856e8a375a3725e..fe34b4d73116a68800a2b8f465716e947c096069 100644 (file)
@@ -16,7 +16,7 @@
 class api_v3_ContactTypeTest extends CiviUnitTestCase {
   protected $_apiversion;
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->useTransaction(TRUE);
     $params = [
index c9f7317acbd18e7b7bc1e709a2b6230759cdda49..e7f14a6d81b4f5907c49763e57fd83b7dd48d01d 100644 (file)
@@ -54,7 +54,7 @@ class api_v3_ContributionPageTest extends CiviUnitTestCase {
    *
    * @throws \CRM_Core_Exception
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->contactIds[] = $this->individualCreate();
     $this->params = [
@@ -83,7 +83,7 @@ class api_v3_ContributionPageTest extends CiviUnitTestCase {
    *
    * @throws \CRM_Core_Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     foreach ($this->contactIds as $id) {
       $this->callAPISuccess('contact', 'delete', ['id' => $id]);
     }
index 551f43ec11ac32e8f72fe76c19d97d2e0892f5ac..2f7f6b5bf765d9bd11a14fc414f0d45a7cd6df33 100644 (file)
@@ -25,7 +25,7 @@ class api_v3_ContributionRecurTest extends CiviUnitTestCase {
   /**
    * @throws \CRM_Core_Exception
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->useTransaction();
     $this->ids['contact'][0] = $this->individualCreate();
index 6880605e793f40d904485f777312a48fdb61d109..a7fad26a9829faa866fae1d874686ff226ab63d8 100644 (file)
@@ -45,7 +45,7 @@ class api_v3_ContributionSoftTest extends CiviUnitTestCase {
   public $debug = 0;
   protected $_params;
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->useTransaction(TRUE);
 
index c3f95ad348edee379bd30be54d7317d2f47593be..082b5d0f57352e501ed3c94e3e7c6110ac39510b 100644 (file)
@@ -62,7 +62,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase {
    *
    * @throws \CRM_Core_Exception
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
 
     $this->_apiversion = 3;
@@ -108,7 +108,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase {
    *
    * @throws \CRM_Core_Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanUpFinancialEntities();
     $this->quickCleanup(['civicrm_uf_match'], TRUE);
     $financialAccounts = $this->callAPISuccess('FinancialAccount', 'get', []);
index c0d82cfed14b1022f46616d111decce0382eff68..982c49ea20cc3c6da9e8fb02dd12e62f14a920b1 100644 (file)
@@ -19,7 +19,7 @@
 class api_v3_CountryTest extends CiviUnitTestCase {
   protected $_params;
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->useTransaction(TRUE);
     $this->_params = [
index 2c78250848c1e9ffddf1f018bd3fe6059f1084bc..1ff50958619438cd16e80be38a2d99021e45c667 100644 (file)
@@ -19,12 +19,12 @@ class api_v3_CustomApiTest extends CiviUnitTestCase {
 
   protected $_apiversion = 3;
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->installApi();
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     parent::tearDown();
     CRM_Core_DAO::executeQuery('DROP TABLE civicrm_mailing_provider_data');
   }
index 6ec1b9cee3e330b6c260c886268bd1ebbba0ccbc..303a91d7c8d122935b751fcebf81b8677fe18201 100644 (file)
@@ -22,7 +22,7 @@ class api_v3_CustomFieldTest extends CiviUnitTestCase {
    *
    * @throws \CRM_Core_Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanup([
       'civicrm_contact',
       'civicrm_file',
index e891f28eb079d70669bcd769d8f26f74c8fe4159..e689a66bf40132566a0c3e1d95cfcc9c2ebc4132 100644 (file)
@@ -23,7 +23,7 @@ class api_v3_CustomGroupTest extends CiviUnitTestCase {
 
   public $DBResetRequired = TRUE;
 
-  public function setUp() {
+  public function setUp(): void {
     $this->_entity = 'CustomGroup';
     $this->_params = [
       'title' => 'Test_Group_1',
@@ -39,7 +39,7 @@ class api_v3_CustomGroupTest extends CiviUnitTestCase {
     parent::setUp();
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     $tablesToTruncate = ['civicrm_custom_group', 'civicrm_custom_field'];
     // true tells quickCleanup to drop any tables that might have been created in the test
     $this->quickCleanup($tablesToTruncate, TRUE);
index 4ac288050b1bf3839b3d21d9a1565d3d92535edb..8c73a3c1d12b89e8a2303f67dda4cd18bda7fa55 100644 (file)
@@ -7,7 +7,7 @@
 class api_v3_CustomSearchTest extends CiviUnitTestCase {
   protected $_apiversion;
 
-  public function setUp() {
+  public function setUp(): void {
     $this->_apiversion = 3;
     parent::setUp();
     $this->useTransaction(TRUE);
index ac35bec145ccd005913aead2756d2c5b648c656a..238104895f6e46fed0db9dd52a51d1311923186c 100644 (file)
@@ -22,7 +22,7 @@ class api_v3_CustomValueContactTypeTest extends CiviUnitTestCase {
   protected $CustomGroupIndividual;
   protected $individualStudent;
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     //  Create Group For Individual  Contact Type
     $groupIndividual = [
@@ -90,7 +90,7 @@ class api_v3_CustomValueContactTypeTest extends CiviUnitTestCase {
     CRM_Core_BAO_CustomField::getTableColumnGroup($this->IndiStudentField['id'], TRUE);
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     $tablesToTruncate = ['civicrm_contact', 'civicrm_cache'];
     $this->quickCleanup($tablesToTruncate, TRUE);
   }
index 96ce2e42c0c68217b7f505884d250942d804bc93..78511ade3bb9790b373b8596e0edeff76abee28c 100644 (file)
@@ -21,10 +21,6 @@ class api_v3_CustomValueTest extends CiviUnitTestCase {
 
   public $DBResetRequired = FALSE;
 
-  public function setUp() {
-    parent::setUp();
-  }
-
   public function _populateOptionAndCustomGroup($type = NULL) {
     $dataValues = [
       'integer' => [1, 2, 3],
@@ -64,7 +60,7 @@ class api_v3_CustomValueTest extends CiviUnitTestCase {
 
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     $tablesToTruncate = [
       'civicrm_email',
       'civicrm_custom_field',
index e5b0728d16036943b3b59dd800dabdc01daa08a8..9c86fd198405c57ff98b142b9ed86a18c67f728a 100644 (file)
@@ -38,7 +38,7 @@ class api_v3_DashboardContactTest extends CiviUnitTestCase {
    * Connect to the database, truncate the tables that will be used
    * and redirect stdin to a temporary file
    */
-  public function setUp() {
+  public function setUp(): void {
     //  Connect to the database
     parent::setUp();
     $this->useTransaction(TRUE);
index 3a21ceff8d6a3c82ed58a9bf20e96d637dd411ca..d9e1f30a19e9429e0278806d3d403f9bfca4d3a6 100644 (file)
@@ -38,7 +38,7 @@ class api_v3_DashboardTest extends CiviUnitTestCase {
    * Connect to the database, truncate the tables that will be used
    * and redirect stdin to a temporary file
    */
-  public function setUp() {
+  public function setUp(): void {
     //  Connect to the database
     parent::setUp();
     $this->useTransaction(TRUE);
index 2a0d2caea7dced643c2dd5281b5d54c489a23646..bb9eb817c80b1071aea6e5d8296f59a92e7dd12b 100644 (file)
@@ -32,7 +32,7 @@ class api_v3_DomainTest extends CiviUnitTestCase {
    *
    * This method is called before a test is executed.
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     $this->useTransaction(TRUE);
 
index 1de8dbf9fdc2b4c003547cd32fa1664853c62068..549e6ba1fcd98db37ef45dc1d7fd45e9c99cdd08 100644 (file)
@@ -21,7 +21,7 @@ class api_v3_EmailTest extends CiviUnitTestCase {
   protected $_entity;
   protected $_params;
 
-  public function setUp() {
+  public function setUp(): void {
     $this->_entity = 'Email';
     parent::setUp();
     $this->useTransaction(TRUE);
index 9446092ee48172911014483beb9e50546fcdbad6..0ed0b96d631038bd6159f598826364a745e5d202 100644 (file)
@@ -23,7 +23,7 @@ class api_v3_EntityBatchTest extends CiviUnitTestCase {
 
   public $DBResetRequired = FALSE;
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->useTransaction(TRUE);
 
index add0099aaa9ec696c987cd003f898c57f64e4daa..fbcbca262f9e21c2faa04bb2fca815d36d9b7a3b 100644 (file)
@@ -17,7 +17,7 @@
  */
 class api_v3_EntityJoinTest extends CiviUnitTestCase {
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->useTransaction(TRUE);
   }
index 7c88088b2801bb5973bebd9f37efb6156470d67f..2227f3b749d7670f55e923b75b7eaf79d6a7f28f 100644 (file)
@@ -45,7 +45,7 @@ class api_v3_EntityTagACLTest extends CiviUnitTestCase {
   /**
    * Set up permissions for test.
    */
-  public function setUp() {
+  public function setUp(): void {
     $this->useTransaction(TRUE);
     parent::setUp();
     $individualID = $this->individualCreate();
index 887b0834958589e41c6dd1c75740c584d427c40e..b99ecdc7d9c637056059780903e3619b7e146323 100644 (file)
@@ -45,7 +45,7 @@ class api_v3_EntityTagTest extends CiviUnitTestCase {
    *
    * @throws \CRM_Core_Exception
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->useTransaction(TRUE);
 
index abebea1d530d5ac66da5de142d64246eb84cf910..5684ebeb9abea8c5c574f17bdd31f57b873c7f7d 100644 (file)
@@ -18,7 +18,7 @@ class api_v3_EventTest extends CiviUnitTestCase {
   protected $_apiversion;
   protected $_entity;
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->_apiversion = 3;
     $this->_entity = 'event';
@@ -81,7 +81,7 @@ class api_v3_EventTest extends CiviUnitTestCase {
     }
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     foreach ($this->eventIds as $eventId) {
       $this->eventDelete($eventId);
     }
index bf0fb4361ec4bfd1e31bd1870ecb1199765caf7c..1a5e38baf08677135139f7c3a6d5c97925ed2ec8 100644 (file)
@@ -22,7 +22,7 @@ class api_v3_ExceptionTest extends CiviUnitTestCase {
    *
    * This method is called before a test is executed.
    */
-  protected function setUp() {
+  protected function setUp(): void {
     $this->useTransaction(TRUE);
     parent::setUp();
   }
index bcfc8f9f4ba5c95420ca892eab09b914a6714fdc..b62d9d474ecace410bd597e3f9104a2af46f2508 100644 (file)
  */
 class api_v3_ExtensionTest extends CiviUnitTestCase {
 
-  public function setUp() {
+  public function setUp(): void {
     $url = 'file://' . dirname(dirname(dirname(dirname(__FILE__)))) . '/mock/extension_browser_results';
     Civi::settings()->set('ext_repo_url', $url);
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     Civi::settings()->revert('ext_repo_url');
   }
 
index e78f9fe5cbf811725789794b59ccb1deeca89f25..38b6eb83d78b2654be2e569dd2be46188619849a 100644 (file)
@@ -46,7 +46,7 @@ class api_v3_FinancialTypeACLTest extends CiviUnitTestCase {
   /**
    * Setup function.
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
 
     $this->_apiversion = 3;
@@ -91,7 +91,7 @@ class api_v3_FinancialTypeACLTest extends CiviUnitTestCase {
    *
    * @throws \Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanUpFinancialEntities();
     $this->quickCleanup(['civicrm_uf_match']);
     $this->disableFinancialACLs();
index d0c3707606408b68b6ccfd35bc7a860d0cc3d4ba..70d9a2fede5d838b4911f895e694360e9cfd46f0 100644 (file)
@@ -24,7 +24,7 @@ class api_v3_GrantTest extends CiviUnitTestCase {
 
   public $DBResetRequired = FALSE;
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->ids['contact'][0] = $this->individualCreate();
     $this->params = [
@@ -44,7 +44,7 @@ class api_v3_GrantTest extends CiviUnitTestCase {
    *
    * @throws \Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     foreach ($this->ids as $entity => $entities) {
       foreach ($entities as $id) {
         $this->callAPISuccess($entity, 'delete', ['id' => $id]);
index aa10784540ceda08dd0366a564461b4abe18837f..44affa37566c7c01ff240d527ad765aa538a5ccc 100644 (file)
@@ -34,7 +34,7 @@ class api_v3_GroupContactTest extends CiviUnitTestCase {
    *
    * @todo set up calls function that doesn't work @ the moment
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->useTransaction(TRUE);
 
index b3a95146483c54db5ec1c9ed4812b27c197525cb..fd34ce92d182a6ebe14192cc777f9226d61dbd34 100644 (file)
@@ -22,7 +22,7 @@ class api_v3_GroupNestingTest extends CiviUnitTestCase {
    *
    * This method is called before a test is executed.
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->ids['Group'] = [];
@@ -55,7 +55,7 @@ class api_v3_GroupNestingTest extends CiviUnitTestCase {
    *
    * @throws \Exception
    */
-  protected function tearDown() {
+  protected function tearDown(): void {
     $this->quickCleanup(
       [
         'civicrm_group',
index 4ed4ed9f0ca043b6280825634bdc941ac67eec3f..aed10a7ea4eb4245c6332e1571f2abeace91ba9f 100644 (file)
@@ -22,7 +22,7 @@ class api_v3_GroupOrganizationTest extends CiviUnitTestCase {
    * Sets up the fixture, for example, opens a network connection.
    * This method is called before a test is executed.
    */
-  protected function setUp() {
+  protected function setUp(): void {
     $this->_apiversion = 3;
     parent::setUp();
     $this->useTransaction(TRUE);
index f6edd05bc3f646144d0a13e107f6f2fd5965c6b2..4a9f8aa211930fc1c94c310ab0c9e2a49fae854e 100644 (file)
@@ -22,7 +22,7 @@ class api_v3_GroupTest extends CiviUnitTestCase {
   /**
    * Set up for tests.
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->_groupID = $this->groupCreate();
     $config = CRM_Core_Config::singleton();
@@ -34,7 +34,7 @@ class api_v3_GroupTest extends CiviUnitTestCase {
    *
    * @throws \Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     CRM_Utils_Hook::singleton()->reset();
     $config = CRM_Core_Config::singleton();
     unset($config->userPermissionClass->permissions);
index 1ddcefe008dcfa7dd8257ad6b3b1186293f0ab14..600284120138e7887693a7ed9a7a4405a8113af2 100644 (file)
@@ -23,7 +23,7 @@ class api_v3_ImTest extends CiviUnitTestCase {
 
   public $DBResetRequired = FALSE;
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->useTransaction(TRUE);
 
index 163ef35b212b2ce6ecc6dbe61bffe4a0b37c5eb2..0c75c11767eb67093811947ad0d10e3d56a35460 100644 (file)
@@ -40,7 +40,7 @@ class api_v3_JobProcessMailingTest extends CiviUnitTestCase {
    */
   private $_mut;
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     // DGW
     CRM_Mailing_BAO_MailingJob::$mailsProcessed = 0;
@@ -80,7 +80,7 @@ class api_v3_JobProcessMailingTest extends CiviUnitTestCase {
 
   /**
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->_mut->stop();
     CRM_Utils_Hook::singleton()->reset();
     $this->cleanupMailingTest();
index e0eaccbd5415eaeff6b2f4d55ea377422e35cb12..e35484282a7c678970a499a4ad5dad7bec1d184a 100644 (file)
@@ -60,7 +60,7 @@ class api_v3_JobProcessMembershipTest extends CiviUnitTestCase {
    */
   public $_tomorrow;
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->loadReferenceDates();
     $this->loadMembershipStatuses();
@@ -95,7 +95,7 @@ class api_v3_JobProcessMembershipTest extends CiviUnitTestCase {
     $this->_tomorrow = date('Y-m-d', time() + 60 * 60 * 24);
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     parent::tearDown();
 
     // For each case, the `old` membershipt type must start as
index 33062c5848abb4fac12b5b0e656faed6d07b2f03..fa972463f2ab7248941aaf2ded4c743c0163ace5 100644 (file)
@@ -68,7 +68,7 @@ class api_v3_JobTestCustomDataTest extends CiviUnitTestCase {
    */
   public $customGroupID = NULL;
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $customGroup = $this->customGroupCreate();
     $this->customGroupID = $customGroup['id'];
@@ -111,7 +111,7 @@ class api_v3_JobTestCustomDataTest extends CiviUnitTestCase {
    *
    * @throws \CRM_Core_Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanup(['civicrm_contact'], TRUE);
     parent::tearDown();
   }
index 29b83485a70a85ae1d16b7d8050a890e65c5be6c..7ff061a4392f90a7d236e31502defc4da4063912 100644 (file)
@@ -24,7 +24,7 @@ class api_v3_LineItemTest extends CiviUnitTestCase {
    *
    * @throws \CRM_Core_Exception
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->useTransaction();
     $contributionParams = [
index 26d532dd60b3656033b56484b6ec250b48f2871e..c7751fed7a2946551665eaedd4467cd847e5afb7 100644 (file)
@@ -23,7 +23,7 @@ class api_v3_LocBlockTest extends CiviUnitTestCase {
   /**
    * Set up.
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->useTransaction(TRUE);
   }
index e2f6cbd5e262cde0d1e728286d6b8f057f8b0f99..a25dbb863f040eaf4e3875bacab2b378fc6dd6d1 100644 (file)
@@ -22,7 +22,7 @@ class api_v3_LoggingTest extends CiviUnitTestCase {
    *
    * This method is called before a test is executed.
    */
-  protected function setUp() {
+  protected function setUp(): void {
     $this->ensureTempColIsCleanedUp();
     parent::setUp();
   }
@@ -30,7 +30,7 @@ class api_v3_LoggingTest extends CiviUnitTestCase {
   /**
    * Clean up log tables.
    */
-  protected function tearDown() {
+  protected function tearDown(): void {
     $this->quickCleanup(['civicrm_email', 'civicrm_address']);
     parent::tearDown();
     $this->callAPISuccess('Setting', 'create', ['logging' => FALSE]);
index c9d62b7a9c742b06edfa0c1dcd2d8282dcbe9099..534e24ce6bddcb408bdf003cd196ba9a0fcb8d0c 100644 (file)
@@ -24,7 +24,7 @@ class api_v3_MailSettingsTest extends CiviUnitTestCase {
 
   public $DBResetRequired = FALSE;
 
-  public function setUp() {
+  public function setUp(): void {
     $this->params = [
       'domain_id' => 1,
       'name' => "my mail setting",
index 39fc24579313a99447a754e143e8df62fd999b4d..d31d66fd5f018a261eff962774cd5fb173de6dcb 100644 (file)
@@ -38,7 +38,7 @@ class api_v3_MailingABTest extends CiviUnitTestCase {
   protected $_entity = 'MailingAB';
   protected $_groupID;
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->useTransaction(TRUE);
     $this->createLoggedInUser();
index 0000fcf4fdb440a54e9a62d3d2ba5fa2c667f85f..9fe67eb990674aa73424e52836211a3d54244a26 100644 (file)
@@ -26,7 +26,7 @@
 class api_v3_MailingContactTest extends CiviUnitTestCase {
   protected $_entity = 'mailing';
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $params = [
       'first_name' => 'abc1',
@@ -36,7 +36,7 @@ class api_v3_MailingContactTest extends CiviUnitTestCase {
     $this->_contact = $this->callAPISuccess("contact", "create", $params);
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     $this->callAPISuccess("contact", "delete", ['id' => $this->_contact['id']]);
     parent::tearDown();
   }
index e1b09ea9234a3221a45db6df2f6b67e2e0249512..27e78ffc2178e2483f08a712cf0e1b28b6220442 100644 (file)
@@ -20,7 +20,7 @@ class api_v3_MailingGroupTest extends CiviUnitTestCase {
   protected $_email;
   protected $_apiversion;
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->useTransaction(TRUE);
     $this->_apiversion = 3;
index bbf99310abdc47c03ade561fde28fe91232f22f6..f2e325fe80c2c044a5f185553bc6dd2948d2b8b5 100644 (file)
@@ -44,7 +44,7 @@ class api_v3_MailingTest extends CiviUnitTestCase {
    */
   protected $footer;
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->useTransaction();
     // DGW
@@ -70,7 +70,7 @@ class api_v3_MailingTest extends CiviUnitTestCase {
     ]);
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     // DGW
     CRM_Mailing_BAO_MailingJob::$mailsProcessed = 0;
     parent::tearDown();
index ad6ab9dfc3663c026b47d06992ef9d905db8124d..eac98e582a13bdecb5de88872f433c27d6def0bb 100644 (file)
@@ -25,7 +25,7 @@ class api_v3_MappingFieldTest extends CiviUnitTestCase {
 
   public $DBResetRequired = FALSE;
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->useTransaction(TRUE);
 
index 729c7f9a686de26856c69f9fd75e3cfdce45fb8d..f8fc8376b1a15cc95d5b8746a1c134ea9ddaadce 100644 (file)
@@ -25,7 +25,7 @@ class api_v3_MappingTest extends CiviUnitTestCase {
 
   public $DBResetRequired = FALSE;
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->useTransaction(TRUE);
 
index 92b689ce39d2e329b575093d5003f3090c2f9a76..72d6610c6d977730d64a6ed62e562dca835ec3d3 100644 (file)
@@ -23,7 +23,7 @@ class api_v3_MembershipPaymentTest extends CiviUnitTestCase {
   protected $_membershipStatusID;
   protected $_contribution = [];
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->useTransaction(TRUE);
 
index fbdf71a43e1e1d5a6fc33b62f6a9ec5041a3aa39..c7f693c48b671e00b72db0b88d8d0cb43416bf0a 100644 (file)
@@ -21,7 +21,7 @@ class api_v3_MembershipStatusTest extends CiviUnitTestCase {
 
   protected $_apiversion = 3;
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->_contactID = $this->individualCreate();
     $this->_membershipTypeID = $this->membershipTypeCreate(['member_of_contact_id' => $this->_contactID]);
@@ -36,7 +36,7 @@ class api_v3_MembershipStatusTest extends CiviUnitTestCase {
    *
    * @throws \CRM_Core_Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->membershipStatusDelete($this->_membershipStatusID);
     $this->membershipTypeDelete(['id' => $this->_membershipTypeID]);
     $this->contactDelete($this->_contactID);
index 4550d1eff110acde3b783d294b3e3382a55eb61f..24feffa2a1d764ff5cb85d4262d13af21f2b5d99 100644 (file)
@@ -41,7 +41,7 @@ class api_v3_MembershipTest extends CiviUnitTestCase {
   /**
    * Set up for tests.
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->_contactID = $this->individualCreate();
     $this->_membershipTypeID = $this->membershipTypeCreate(['member_of_contact_id' => $this->_contactID]);
@@ -76,7 +76,7 @@ class api_v3_MembershipTest extends CiviUnitTestCase {
    *
    * @throws \Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanUpFinancialEntities();
     $this->quickCleanup(['civicrm_uf_match'], TRUE);
     $this->contactDelete($this->_contactID);
index 170cee5ccdc3c84be78c4e6dfd6a0c819003de7a..4ffc4b1437f43073d4a573dff0e65ad550d5fa64 100644 (file)
@@ -20,7 +20,7 @@ class api_v3_MembershipTypeTest extends CiviUnitTestCase {
   /**
    * Set up for tests.
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->useTransaction(TRUE);
     $this->_contactID = $this->organizationCreate();
index 34e10d86bc7d79c392be1f9f79e91b8f436e4dd6..5272a1cc63c179b26053c4ed2ba8acaff0d1f5f7 100644 (file)
@@ -20,7 +20,7 @@ class api_v3_MessageTemplateTest extends CiviUnitTestCase {
   protected $entity = 'MessageTemplate';
   protected $params;
 
-  public function setUp() {
+  public function setUp(): void {
     $this->_apiversion = 3;
     parent::setUp();
     $this->useTransaction(TRUE);
@@ -36,7 +36,7 @@ class api_v3_MessageTemplateTest extends CiviUnitTestCase {
     ];
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     parent::tearDown();
     unset(CRM_Core_Config::singleton()->userPermissionClass->permissions);
   }
index 7c23093bd6944bcf3251bf29713fa4da1be1d144..f619443929107ab63824ca1fc0a1235d44f95cc5 100644 (file)
@@ -24,12 +24,12 @@ class api_v3_MultilingualTest extends CiviUnitTestCase {
    *
    * This method is called before a test is executed.
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     $this->useTransaction(TRUE);
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     CRM_Core_I18n_Schema::makeSinglelingual('en_US');
     parent::tearDown();
   }
index 8b2021df46fefd4be7e4a04423145cb7b6b83fa1..a0c5bf0e5b1f18eff3a5eb2edbd443c20a7b9210 100644 (file)
@@ -20,7 +20,7 @@ class api_v3_NoteTest extends CiviUnitTestCase {
   protected $_noteID;
   protected $_note;
 
-  public function setUp() {
+  public function setUp(): void {
 
     // Connect to the database.
     parent::setUp();
index 5c554ab006d756feac8e4249f59074de764a91a7..34db4ab6e8c7e7ec0d50294f92855285d089cd3c 100644 (file)
@@ -31,7 +31,7 @@ class api_v3_OpenIDTest extends CiviUnitTestCase {
 
   public $DBResetRequired = FALSE;
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->useTransaction();
 
index 1a5272c2c2e4ccea6a5bc1a30fc4c92ba6bdd6fd..daf2ff0012588f9366fa115b920dec99f48f64ab 100644 (file)
@@ -20,7 +20,7 @@ class api_v3_OptionGroupTest extends CiviUnitTestCase {
 
   protected $_entity = 'OptionGroup';
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->useTransaction(TRUE);
     $this->_params = [
index 623296a559d986dbcbd54f29c7a7c0c3a7c252c6..6641cde5ad7b56eeb22a86cddb5095d911d90d44 100644 (file)
@@ -16,7 +16,7 @@
 class api_v3_OptionValueTest extends CiviUnitTestCase {
   protected $_apiversion = 3;
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->useTransaction(TRUE);
   }
index 55856dd122c0c24c493ecc3fa69caec8e53b9258..497d5bc3a0531c65d11cdd5d350a99a051ea68ef 100644 (file)
@@ -27,7 +27,7 @@ class api_v3_OrderTest extends CiviUnitTestCase {
    *
    * @throws \CRM_Core_Exception
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
 
     $this->_apiversion = 3;
@@ -39,7 +39,7 @@ class api_v3_OrderTest extends CiviUnitTestCase {
    *
    * @throws \CRM_Core_Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanUpFinancialEntities();
     $this->quickCleanup(['civicrm_uf_match']);
   }
index e040c69b8dda896a43c8ae517fcba6600d460ff3..2841eeb44a95623a0fb50477ff51fa653976a756 100644 (file)
@@ -29,7 +29,7 @@ class api_v3_ParticipantPaymentTest extends CiviUnitTestCase {
   /**
    * Set up for tests.
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->useTransaction(TRUE);
     $event = $this->eventCreate(NULL);
index a7e74ddc82b61e37e566f8b70d81073af1c5ab30..441b12ccbc7892fd1d84f96a57f5b86010af019b 100644 (file)
@@ -20,7 +20,7 @@ class api_v3_ParticipantStatusTypeTest extends CiviUnitTestCase {
 
   public $DBResetRequired = FALSE;
 
-  public function setUp() {
+  public function setUp(): void {
     $this->_apiversion = 3;
     $this->params = [
       'name' => 'test status',
index 6c485116b4677b7ab35be7338aca2bf1823955c3..954c34e9bbe54108efb2a92286b642a686b4cea3 100644 (file)
@@ -31,7 +31,7 @@ class api_v3_ParticipantTest extends CiviUnitTestCase {
   protected $_individualId;
   protected $_params;
 
-  public function setUp() {
+  public function setUp(): void {
     $this->_apiversion = 3;
     parent::setUp();
     $this->_entity = 'participant';
@@ -68,7 +68,7 @@ class api_v3_ParticipantTest extends CiviUnitTestCase {
     ];
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     $this->eventDelete($this->_eventID);
     $tablesToTruncate = [
       'civicrm_custom_group',
index 115040870f082d0532cebae47585ae25b0686221..1d8859a867ecbf759e6aa9e828caaff9ad9eb002 100644 (file)
@@ -23,7 +23,7 @@ class api_v3_PaymentProcessorTest extends CiviUnitTestCase {
    *
    * @throws \CRM_Core_Exception
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->useTransaction(TRUE);
     // Create dummy processor
index cd5760a5ac7314c3a7c9c5b4cb01ad5c976191f4..4e5709831e7b7440ff4fd99e1dffbe37df75a85e 100644 (file)
 class api_v3_PaymentProcessorTypeTest extends CiviUnitTestCase {
   protected $_ppTypeID;
 
-  public function setUp() {
+  public function setUp(): void {
 
     parent::setUp();
     $this->useTransaction(TRUE);
   }
 
-  //  function tearDown() {
+  //  function tearDown(): void {
   //
   //    $tablesToTruncate = array(
   //      'civicrm_payment_processor_type',
index ad9f744763dcdda2736c4a29ad554e20b17cc499..e319f5040758bffe3598632584c5cb4b398183d1 100644 (file)
@@ -27,7 +27,7 @@ class api_v3_PaymentTest extends CiviUnitTestCase {
    *
    * @throws \CRM_Core_Exception
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
 
     $this->_apiversion = 3;
@@ -40,7 +40,7 @@ class api_v3_PaymentTest extends CiviUnitTestCase {
    *
    * @throws \Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanUpFinancialEntities();
     $this->quickCleanup(['civicrm_uf_match']);
     unset(CRM_Core_Config::singleton()->userPermissionClass->permissions);
index 85cefb35889f477d97d180a2175ce5421b438853..a19200f7d24ab950f183f52d91b879ac35ae476d 100644 (file)
@@ -20,7 +20,7 @@ class api_v3_PaymentTokenTest extends CiviUnitTestCase {
 
   public $DBResetRequired = FALSE;
 
-  public function setUp() {
+  public function setUp(): void {
     $this->_apiversion = 3;
     $this->useTransaction(TRUE);
     parent::setUp();
index 4f609a448c8aa71c5cba42a67b8fcdb09aefdf56..500f963a929360661535bddfd81cecf37043922b 100644 (file)
@@ -33,7 +33,7 @@ class api_v3_PcpTest extends CiviUnitTestCase {
   protected $entity = 'Pcp';
   public $DBResetRequired = TRUE;
 
-  public function setUp() {
+  public function setUp(): void {
     $this->params = [
       'title' => "Pcp title",
       'contact_id' => 1,
index ea2cbc882ffc9107e37f8d642bf2ea46e0413788..0f34561d3b1d948d18d3038f7457c9b167efc536 100644 (file)
@@ -29,7 +29,7 @@ class api_v3_PhoneTest extends CiviUnitTestCase {
    */
   protected $isLocationTypesOnPostAssert = TRUE;
 
-  public function setUp() {
+  public function setUp(): void {
     $this->_entity = 'Phone';
     parent::setUp();
     $this->useTransaction();
index f3a374335b30a5c62c89e100b4ca7409cd148ab2..4f1afba6c7a29d9416bfe380acfb829744bbf4b7 100644 (file)
@@ -28,7 +28,7 @@ class api_v3_PledgePaymentTest extends CiviUnitTestCase {
    *
    * @throws \CRM_Core_Exception
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->_individualId = $this->individualCreate();
     $this->_pledgeID = $this->pledgeCreate(['contact_id' => $this->_individualId]);
@@ -39,7 +39,7 @@ class api_v3_PledgePaymentTest extends CiviUnitTestCase {
    * Clean up after function.
    * @throws \CRM_Core_Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $tablesToTruncate = [
       'civicrm_contribution',
       'civicrm_contact',
index f624c6ba09d18af02646ee17ce78ede7bb5c061b..9e8358d3965285b98586ee804aab730fdca993ba 100644 (file)
@@ -26,7 +26,7 @@ class api_v3_PledgeTest extends CiviUnitTestCase {
   /**
    * @throws \CRM_Core_Exception
    */
-  public function setUp() {
+  public function setUp(): void {
     $this->_apiversion = 3;
     parent::setUp();
     $this->quickCleanup(['civicrm_pledge', 'civicrm_pledge_payment']);
@@ -52,7 +52,7 @@ class api_v3_PledgeTest extends CiviUnitTestCase {
     ];
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     $this->contactDelete($this->_individualId);
   }
 
index c4c6ec7f445444cb73966ba7053cbc7cba42cbfd..3f68eafaf099b7d768beabb3b9399a5f5da6c629 100644 (file)
@@ -24,7 +24,7 @@ class api_v3_PriceFieldTest extends CiviUnitTestCase {
    *
    * @throws \CRM_Core_Exception
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $priceSetparams = [
       'name' => 'default_goat_priceset',
@@ -56,7 +56,7 @@ class api_v3_PriceFieldTest extends CiviUnitTestCase {
    *
    * @throws \CRM_Core_Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $tablesToTruncate = [
       'civicrm_contact',
       'civicrm_contribution',
index dca3b97ab2885c6ffb39bafb7817d1cfb04d6669..24518fe5cdc690dd372461a74dcd45d94fd56451 100644 (file)
@@ -30,7 +30,7 @@ class api_v3_PriceFieldValueTest extends CiviUnitTestCase {
   /**
    * Setup function.
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     // Put stuff here that should happen before all tests in this unit.
     $priceSetParams = [
@@ -96,7 +96,7 @@ class api_v3_PriceFieldValueTest extends CiviUnitTestCase {
    *
    * @throws \Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $tablesToTruncate = [
       'civicrm_contact',
       'civicrm_contribution',
index fbe747c2d331d58edb161723db9b10b0e746924e..1fa81b255f3358e1640ca76f1db32624f5c1384e 100644 (file)
@@ -25,7 +25,7 @@ class api_v3_PriceSetTest extends CiviUnitTestCase {
   /**
    * Set up for class.
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->_params = [
       'name' => 'default_goat_priceset',
index 73d685cb882020d4ab1f8754787824d90d641e66..d68c3e9d2a7574ff6d80c11b03bdfeebf22f6d14 100644 (file)
@@ -19,7 +19,7 @@ class api_v3_ProductTest extends CiviUnitTestCase {
 
   protected $_entity = 'Product';
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->useTransaction();
     $this->_params = [
index 094bfcb7addd84b216bb7bf4c6f9bc39aa719f4a..8733289fc3faa0fd5ad70ce627794cf2614f32b2 100644 (file)
@@ -27,7 +27,7 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
   /**
    * Set up for test.
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $config = CRM_Core_Config::singleton();
     $countryLimit = $config->countryLimit;
@@ -43,7 +43,7 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
    *
    * @throws \Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
 
     $this->quickCleanup([
       'civicrm_contact',
index 94b2899a04e4144006aa2c56014bf01e7f48d56c..963a5bdd5d9bbaa5361ac4417e2dff13fb8a0ee2 100644 (file)
@@ -41,7 +41,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
   /**
    * Set up function.
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->_cId_a = $this->individualCreate();
     $this->_cId_a_2 = $this->individualCreate([
@@ -79,7 +79,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
    *
    * @throws \Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->contactDelete($this->_cId_a);
     $this->contactDelete($this->_cId_a_2);
     $this->contactDelete($this->_cId_b);
index b9b4f6706ad95bd626b6922eb8e3238eab56bee8..db1716cc2c130403b3599925a124f8c91558b78f 100644 (file)
@@ -20,14 +20,14 @@ class api_v3_RelationshipTypeTest extends CiviUnitTestCase {
   protected $_relTypeID;
   protected $_apiversion = 3;
 
-  public function setUp() {
+  public function setUp(): void {
 
     parent::setUp();
     $this->_cId_a = $this->individualCreate();
     $this->_cId_b = $this->organizationCreate();
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
 
     $tablesToTruncate = [
       'civicrm_contact',
index 5335a8eb53bc84b612dcdaf982a9cbd4292ae5da..2076fd3ee1a1dd010588da4f965f275f132d5cbb 100644 (file)
@@ -29,7 +29,7 @@ class api_v3_ReportTemplateTest extends CiviUnitTestCase {
    *
    * @throws \Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanUpFinancialEntities();
     $this->quickCleanup(['civicrm_group', 'civicrm_saved_search', 'civicrm_group_contact', 'civicrm_group_contact_cache', 'civicrm_group'], TRUE);
     parent::tearDown();
index 2b227ca07d56f76564b363440262617a9e79937c..ed303c8ae491d94d36a1955e00976f815661425f 100644 (file)
@@ -40,7 +40,7 @@ class api_v3_SavedSearchTest extends CiviUnitTestCase {
   protected $_entity;
   public $DBResetRequired = FALSE;
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
 
     // The line below makes it unneccessary to do cleanup after a test,
@@ -68,7 +68,7 @@ class api_v3_SavedSearchTest extends CiviUnitTestCase {
   /**
    * Create a saved search, and see whether the returned values make sense.
    */
-  public function testCreateSavedSearch() {
+  public function testCreateSavedSearch(): void {
     $contactID = $this->createLoggedInUser();
     $result = $this->callAPIAndDocument(
         $this->_entity, 'create', $this->params, __FUNCTION__, __FILE__)['values'];
@@ -91,7 +91,7 @@ class api_v3_SavedSearchTest extends CiviUnitTestCase {
    * Create a saved search, retrieve it again, and check for ID and one of
    * the field values.
    */
-  public function testCreateAndGetSavedSearch() {
+  public function testCreateAndGetSavedSearch(): void {
     // Arrange:
     // (create a saved search)
     $create_result = $this->callAPISuccess(
@@ -115,7 +115,7 @@ class api_v3_SavedSearchTest extends CiviUnitTestCase {
    * Create a saved search, and test whether it can be used for a smart
    * group.
    */
-  public function testCreateSavedSearchWithSmartGroup() {
+  public function testCreateSavedSearchWithSmartGroup(): void {
     // First create a volunteer for the default organization
 
     $result = $this->callAPISuccess('Contact', 'create', [
@@ -161,7 +161,61 @@ class api_v3_SavedSearchTest extends CiviUnitTestCase {
     $this->assertEquals($contact_id, $get_result['values'][$contact_id]['id']);
   }
 
-  public function testDeleteSavedSearch() {
+  /**
+   * Create a saved search, and test whether it can be used for a smart
+   * group. Also check that when the Group is deleted the associated saved search gets deleted.
+   * @dataProvider versionThreeAndFour
+   */
+  public function testSavedSearchIsDeletedWhenSmartGroupIs($apiVersion): void {
+    $this->_apiVersion = $apiVersion;
+    // First create a volunteer for the default organization
+
+    $result = $this->callAPISuccess('Contact', 'create', [
+      'first_name' => 'Joe',
+      'last_name' => 'Schmoe',
+      'contact_type' => 'Individual',
+      'api.Relationship.create' => [
+        'contact_id_a' => '$value.id',
+        // default organization:
+        'contact_id_b' => 1,
+        // volunteer relationship:
+        'relationship_type_id' => 6,
+        'is_active' => 1,
+      ],
+    ]);
+    $contact_id = $result['id'];
+
+    // Now create our saved search, and chain the creation of a smart group.
+    $params = $this->params;
+    $params['api.Group.create'] = [
+      'name' => 'my_smartgroup',
+      'title' => 'my smartgroup',
+      'description' => 'Volunteers for the default organization',
+      'saved_search_id' => '$value.id',
+      'is_active' => 1,
+      'visibility' => 'User and User Admin Only',
+      'is_hidden' => 0,
+      'is_reserved' => 0,
+    ];
+
+    $create_result = $this->callAPISuccess($this->_entity, 'create', $params);
+
+    $created_search = CRM_Utils_Array::first($create_result['values']);
+    $group_id = $created_search['api.Group.create']['id'];
+
+    // Search for contacts in our new smart group
+    $get_result = $this->callAPISuccess('Contact', 'get', ['group' => $group_id]);
+
+    // Expect our contact to be there.
+    $this->assertEquals(1, $get_result['count']);
+    $this->assertEquals($contact_id, $get_result['values'][$contact_id]['id']);
+
+    $this->callAPISuccess('Group', 'delete', ['id' => $group_id]);
+    $savedSearch = $this->callAPISuccess('SavedSearch', 'get', ['id' => $created_search['id']]);
+    $this->assertCount(0, $savedSearch['values']);
+  }
+
+  public function testDeleteSavedSearch(): void {
     // Create saved search, delete it again, and try to get it
     $create_result = $this->callAPISuccess($this->_entity, 'create', $this->params);
     $delete_params = ['id' => $create_result['id']];
index ebf0acc34f4fff6b043416bc8aa2348e8e4af892..183772d2f8005c140561ef96d2f900d554ad6b2d 100644 (file)
@@ -20,7 +20,7 @@ class api_v3_SelectQueryTest extends CiviUnitTestCase {
   private $hookEntity;
   private $hookCondition = [];
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->useTransaction(TRUE);
     CRM_Utils_Hook::singleton()->setHook('civicrm_selectWhereClause', [$this, 'hook_civicrm_selectWhereClause']);
index f75f46207a78bd81c3a88579b72a066a553a3420..1bc407ee8258fdf9c36e0f9c764d0619a91e4b31 100644 (file)
@@ -29,7 +29,7 @@ class api_v3_SettingTest extends CiviUnitTestCase {
   protected $_domainID2;
   protected $_domainID3;
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $params = [
       'name' => __CLASS__ . 'Second Domain',
@@ -50,7 +50,7 @@ class api_v3_SettingTest extends CiviUnitTestCase {
     $this->hookClass = CRM_Utils_Hook::singleton();
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     CRM_Utils_Hook::singleton()->reset();
     parent::tearDown();
     $this->callAPISuccess('system', 'flush', []);
index 7085bf5efb2215695a83ada444ecdab05446ba00..15635ac2b768b545a255505c6febfba029785663 100644 (file)
@@ -19,7 +19,7 @@
 class api_v3_StateProvinceTest extends CiviUnitTestCase {
   protected $_params;
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->useTransaction(TRUE);
     $this->_params = [
index 6d9b117ad798a1f00c594a1ce4d57f5dd60b6504..d566260c41e01083a5192f5e74b52ed2d6d4b7e8 100644 (file)
@@ -20,7 +20,7 @@ class api_v3_StatusPreferenceTest extends CiviUnitTestCase {
   protected $_locationType;
   protected $_params;
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->useTransaction(TRUE);
     $this->_params = [
index 4b71be0c6d33b63490a05039b75259e4b8600289..8b05ed863cb111741ac803f1f71c1c57af68783d 100644 (file)
@@ -17,7 +17,7 @@ class api_v3_SurveyRespondantTest extends CiviUnitTestCase {
   protected $_apiversion = 3;
   protected $params;
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->useTransaction(TRUE);
     $phoneBankActivity = $this->callAPISuccess('Option_value', 'Get', ['label' => 'PhoneBank', 'sequential' => 1]);
index cd2c532d8f5919cb34662b0fa026fc78a2ab176d..d08f53cc87539a184ff432d3f3a1861afd49914d 100644 (file)
@@ -33,7 +33,7 @@ class api_v3_SurveyTest extends CiviUnitTestCase {
   protected $entity = 'survey';
   public $DBResetRequired = FALSE;
 
-  public function setUp() {
+  public function setUp(): void {
     $phoneBankActivityTypeID = $this->callAPISuccessGetValue('Option_value', [
       'label' => 'PhoneBank',
       'return' => 'value',
index afffa613bf9a46bcf9b5688ca5e42ad86548cbfb..bcc4326976a59a8206fffad9971e5f9b4011d352 100644 (file)
@@ -81,7 +81,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase {
    * and that will never exist (eg an obsoleted Entity
    * they need to be returned by the function toBeSkipped_{$action} (because it has to be a static method and therefore couldn't access a this->toBeSkipped)
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->enableCiviCampaign();
     $this->toBeImplemented['get'] = [
@@ -132,7 +132,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase {
     $this->deletableTestObjects = [];
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     foreach ($this->deletableTestObjects as $entityName => $entities) {
       foreach ($entities as $entityID) {
         CRM_Core_DAO::deleteTestObjects($entityName, ['id' => $entityID]);
@@ -753,6 +753,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase {
           'website_type_id',
           // Not a real field
           'option.autoweight',
+          'field_name',
         ],
         'break_return' => [
           // These fields get auto-adjusted by the BAO prior to saving
index 89d2df1f0cf3638666aa728dab622a29a3ab2242..d44f062fba644d28fb920e0eedd137366a9815d3 100644 (file)
@@ -21,7 +21,7 @@
  */
 class api_v3_SystemCheckTest extends CiviUnitTestCase {
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->useTransaction(TRUE);
   }
index 7aef4b55af8bceade083bde78b845a287235eda0..8eae0622a712adc83d4c537e174fddb5b79a9e3a 100644 (file)
@@ -25,7 +25,7 @@ class api_v3_SystemTest extends CiviUnitTestCase {
    *
    * This method is called before a test is executed.
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     $this->useTransaction(TRUE);
   }
index 59c2d06abf320f4e7b4f3b6bf640c7fc5c194790..7623378bdb0aaaffd1a67ed46d773d6472630e84 100644 (file)
@@ -32,7 +32,7 @@ class api_v3_TagTest extends CiviUnitTestCase {
 
   protected $tagID;
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->useTransaction(TRUE);
     $this->tag = $this->tagCreate();
index 2e040467deeb87f719d5eb03ca51450948369a72..0167412e07e3049040d494f244f567e853ccf756 100644 (file)
@@ -31,7 +31,7 @@ class api_v3_TaxContributionPageTest extends CiviUnitTestCase {
   protected $halfFinancialAccId;
   protected $halfFinancialTypeId;
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->_individualId = $this->individualCreate();
     $this->_orgId = $this->organizationCreate(NULL);
@@ -128,7 +128,7 @@ class api_v3_TaxContributionPageTest extends CiviUnitTestCase {
   /**
    * Cleanup after function.
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanUpFinancialEntities();
     parent::tearDown();
   }
index 15ef6ec1bec5ba3a7e6c2e212108052fe6efd253..a65cd8d5a72f14397996a84078f8c3051313c6af 100644 (file)
@@ -37,7 +37,7 @@ class api_v3_UFFieldTest extends CiviUnitTestCase {
    *
    * @throws \Exception
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     $this->quickCleanup(
       [
@@ -73,7 +73,7 @@ class api_v3_UFFieldTest extends CiviUnitTestCase {
    *
    * @throws \Exception
    */
-  public function tearDown() {
+  public function tearDown(): void {
     $this->quickCleanup(
       [
         'civicrm_group',
index be06e412fe584f8d837df1bd0c0e63cbdfe8a5e0..dd3c5dcb7442b23f3ffb4e00d7f29f450c2cd50d 100644 (file)
@@ -27,7 +27,7 @@ class api_v3_UFGroupTest extends CiviUnitTestCase {
   protected $_groupId;
   protected $params;
 
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     $this->_groupId = $this->groupCreate();
     $this->_contactId = $this->individualCreate();
@@ -68,7 +68,7 @@ class api_v3_UFGroupTest extends CiviUnitTestCase {
     ];
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     //  Truncate the tables
     $this->quickCleanup(
       [
index 71f04a1bd1b6ba4a40eba1719ed067bf4c1adafb..f7a76870f7df8c95e58d1da6e3db161e1dcfe924 100644 (file)
@@ -25,7 +25,7 @@ class api_v3_UFJoinTest extends CiviUnitTestCase {
   protected $_ufFieldId;
   protected $_contactId = 69;
 
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     //  Truncate the tables
     $this->quickCleanup(
@@ -40,7 +40,7 @@ class api_v3_UFJoinTest extends CiviUnitTestCase {
     $this->loadXMLDataSet(dirname(__FILE__) . '/dataset/uf_group_test.xml');
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     //  Truncate the tables
     $this->quickCleanup(
       [
index 2e1d50901ea1d322eac93b2bb47158b605985287..e0671893d00247a6c2a848a5e884634d137796ec 100644 (file)
@@ -26,7 +26,7 @@ class api_v3_UFMatchTest extends CiviUnitTestCase {
   protected $_contactId;
   protected $_params = [];
 
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     $this->quickCleanup(
       [
@@ -48,7 +48,7 @@ class api_v3_UFMatchTest extends CiviUnitTestCase {
     ];
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     //  Truncate the tables
     $this->quickCleanup(
       [
index aeb70e0a7d18ebcfca77126081475dc611232551..7d819181b39a2c44d33a03a09b49914e2efd9d48 100644 (file)
@@ -24,7 +24,7 @@ class api_v3_UserTest extends CiviUnitTestCase {
 
   public $DBResetRequired = FALSE;
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->contactID = $this->createLoggedInUser();
     $this->params = [
index 3e1d5b27f5cba1e38a98ae1d02e761aefe147936..ffc68eb560f38c350f565c4fe2cd3189805608cd 100644 (file)
@@ -28,7 +28,7 @@ class api_v3_UtilsTest extends CiviUnitTestCase {
    *
    * This method is called before a test is executed.
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     $this->useTransaction(TRUE);
   }
index 9512744fef76ba46138deb0fe6a2010b831b7ee7..473f397ccac75bd9272b959baad5d6da1043c3ab 100644 (file)
@@ -20,7 +20,7 @@ class api_v3_ValidateTest extends CiviUnitTestCase {
   /**
    * This method is called before a test is executed.
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
   }
 
index 638f10efdfdde783b46bebc783b402734aa3b8bb..b2bc8f670e59303766d71ba46c2326900b7e6715 100644 (file)
@@ -24,7 +24,7 @@ class api_v3_WebsiteTest extends CiviUnitTestCase {
 
   public $DBResetRequired = FALSE;
 
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->useTransaction();
 
index 00f6267c5c85086a71134f745497cb5e63da9520..16274b2ca1c6511d261b1a69f34c28a70e2f43e3 100644 (file)
@@ -30,8 +30,8 @@ use Civi\Api4\CustomGroup;
  */
 class ChainTest extends UnitTestCase {
 
-  public function tearDown() {
-    $result = CustomField::delete()
+  public function tearDown(): void {
+    CustomField::delete()
       ->setCheckPermissions(FALSE)
       ->addWhere('name', '=', 'FavPerson')
       ->addChain('group', CustomGroup::delete()->addWhere('name', '=', 'TestActCus'))
index fe5f4e8363642f66b87a57d51f96eac561be2086..ed140f87386aa09188f2c5ee230d4bcfa696df8a 100644 (file)
@@ -39,7 +39,7 @@ class FkJoinTest extends UnitTestCase {
     return parent::setUpHeadless();
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     $relatedTables = [
       'civicrm_activity',
       'civicrm_phone',
index c2571aa64e9695b7cfb17f3d96265f0bb57c37de..52c012252d19d03a467b9bf828937a75f01b8a39 100644 (file)
@@ -35,7 +35,7 @@ trait OptionCleanupTrait {
     $this->optionValueMaxId = \CRM_Core_DAO::singleValueQuery('SELECT MAX(id) FROM civicrm_option_value');
   }
 
-  public function tearDown() {
+  public function tearDown(): void {
     if ($this->optionValueMaxId) {
       \CRM_Core_DAO::executeQuery('DELETE FROM civicrm_option_value WHERE id > ' . $this->optionValueMaxId);
     }
index 067417b1d8bad4b999f896b80af9e8dc37230f00..9d91f0b582a8c1ce3b55f56b241ab7752cc49710 100644 (file)
@@ -48,15 +48,6 @@ class UnitTestCase extends \PHPUnit\Framework\TestCase implements HeadlessInterf
     return \Civi\Test::headless()->apply();
   }
 
-  /**
-   * Tears down the fixture, for example, closes a network connection.
-   *
-   * This method is called after a test is executed.
-   */
-  public function tearDown() {
-    parent::tearDown();
-  }
-
   /**
    * Quick clean by emptying tables created for the test.
    *
index a53625142a2d681d4b0522c8bbe87147c343ea7f..79708451399df8dfb80b33ca2eb3a5b290b818a9 100644 (file)
@@ -82,7 +82,7 @@
     <table>civicrm_saved_search</table>
     <key>id</key>
     <add>1.1</add>
-    <onDelete>SET NULL</onDelete>
+    <onDelete>CASCADE</onDelete>
   </foreignKey>
   <field>
     <name>is_active</name>
index 17d03c3670ebaa8feb9eef5180f7ae20e538ffb8..e24998f55ef02e30589234643d371d7f3a83d8b5 100644 (file)
@@ -35,6 +35,7 @@
       <label>Relationship</label>
     </html>
     <add>5.29</add>
+    <readonly>true</readonly>
   </field>
   <foreignKey>
     <name>relationship_id</name>
@@ -54,6 +55,7 @@
       <label>Relationship Type</label>
     </html>
     <add>5.29</add>
+    <readonly>true</readonly>
   </field>
   <foreignKey>
     <name>relationship_type_id</name>
@@ -74,6 +76,7 @@
     </pseudoconstant>
     <comment>The cache record is a permutation of the original relationship record. The orientation indicates whether it is forward (a_b) or reverse (b_a) relationship.</comment>
     <add>5.29</add>
+    <readonly>true</readonly>
   </field>
 
   <field>
@@ -87,6 +90,7 @@
       <type>EntityRef</type>
       <label>Contact (Near side)</label>
     </html>
+    <readonly>true</readonly>
   </field>
   <foreignKey>
     <name>near_contact_id</name>
     <pseudoconstant>
       <callback>CRM_Core_PseudoConstant::relationshipTypeOptions</callback>
     </pseudoconstant>
+    <readonly>true</readonly>
   </field>
 
   <field>
       <type>EntityRef</type>
       <label>Contact (Far side)</label>
     </html>
+    <readonly>true</readonly>
   </field>
   <foreignKey>
     <name>far_contact_id</name>
     <pseudoconstant>
       <callback>CRM_Core_PseudoConstant::relationshipTypeOptions</callback>
     </pseudoconstant>
+    <readonly>true</readonly>
   </field>
 
   <index>
     <html>
       <type>CheckBox</type>
     </html>
+    <readonly>true</readonly>
   </field>
   <field>
     <name>start_date</name>
       <type>Select Date</type>
       <formatType>activityDate</formatType>
     </html>
+    <readonly>true</readonly>
   </field>
   <field>
     <name>end_date</name>
       <type>Select Date</type>
       <formatType>activityDate</formatType>
     </html>
+    <readonly>true</readonly>
   </field>
 </table>