Remove campaign pseudoconstants from tests
authorColeman Watts <coleman@civicrm.org>
Sat, 30 Jan 2021 02:45:07 +0000 (21:45 -0500)
committerColeman Watts <coleman@civicrm.org>
Thu, 4 Feb 2021 19:46:29 +0000 (14:46 -0500)
tests/phpunit/CRM/Core/PseudoConstantTest.php
tests/phpunit/CRM/Export/BAO/ExportTest.php

index d83d48f28f3cc397c4d6ccf6f5eb0231772b26d5..36a1dc33b73bb98b1d3ba0f35e2c31300d6fc0ae 100644 (file)
@@ -81,15 +81,6 @@ class CRM_Core_PseudoConstantTest extends CiviUnitTestCase {
     ];
     $result = civicrm_api3('payment_processor', 'create', $api_params);
 
-    // Create a Campaign for testing.
-    $campaign_name = md5(microtime());
-    $api_params = [
-      'title' => $campaign_name,
-      'is_active' => TRUE,
-      'status_id' => 2,
-    ];
-    $result = civicrm_api3('campaign', 'create', $api_params);
-
     // Create a membership type for testing.
     $membership_type = md5(microtime());
     $api_params = [
@@ -243,10 +234,6 @@ class CRM_Core_PseudoConstantTest extends CiviUnitTestCase {
           'fieldName' => 'medium_id',
           'sample' => 'Phone',
         ],
-        [
-          'fieldName' => 'campaign_id',
-          'sample' => $campaign_name,
-        ],
       ],
       'CRM_Campaign_DAO_Campaign' => [
         [
@@ -261,10 +248,6 @@ class CRM_Core_PseudoConstantTest extends CiviUnitTestCase {
         ],
       ],
       'CRM_Campaign_DAO_Survey' => [
-        [
-          'fieldName' => 'campaign_id',
-          'sample' => $campaign_name,
-        ],
         [
           'fieldName' => 'activity_type_id',
           'sample' => 'Phone Call',
@@ -272,10 +255,6 @@ class CRM_Core_PseudoConstantTest extends CiviUnitTestCase {
         ],
       ],
       'CRM_Campaign_DAO_CampaignGroup' => [
-        [
-          'fieldName' => 'campaign_id',
-          'sample' => $campaign_name,
-        ],
         [
           'fieldName' => 'group_type',
           'sample' => 'Include',
@@ -499,10 +478,6 @@ class CRM_Core_PseudoConstantTest extends CiviUnitTestCase {
           'fieldName' => 'payment_instrument_id',
           'sample' => 'Check',
         ],
-        [
-          'fieldName' => 'campaign_id',
-          'sample' => $campaign_name,
-        ],
       ],
       'CRM_Pledge_DAO_PledgePayment' => [
         [
@@ -525,10 +500,6 @@ class CRM_Core_PseudoConstantTest extends CiviUnitTestCase {
           'fieldName' => 'frequency_unit',
           'sample' => 'month',
         ],
-        [
-          'fieldName' => 'campaign_id',
-          'sample' => $campaign_name,
-        ],
       ],
       'CRM_PCP_DAO_PCP' => [
         [
@@ -778,10 +749,6 @@ class CRM_Core_PseudoConstantTest extends CiviUnitTestCase {
           'sample' => ['USD' => 'US Dollar'],
           'max' => 200,
         ],
-        [
-          'fieldName' => 'campaign_id',
-          'sample' => $campaign_name,
-        ],
       ],
       'CRM_Event_DAO_Event' => [
         [
@@ -809,10 +776,6 @@ class CRM_Core_PseudoConstantTest extends CiviUnitTestCase {
           'sample' => ['USD' => 'US Dollar'],
           'max' => 200,
         ],
-        [
-          'fieldName' => 'campaign_id',
-          'sample' => $campaign_name,
-        ],
       ],
       'CRM_Core_DAO_Menu' => [
         [
@@ -833,10 +796,6 @@ class CRM_Core_PseudoConstantTest extends CiviUnitTestCase {
           'fieldName' => 'status_id',
           'sample' => 'New',
         ],
-        [
-          'fieldName' => 'campaign_id',
-          'sample' => $campaign_name,
-        ],
       ],
       'CRM_Member_DAO_MembershipStatus' => [
         [
@@ -891,10 +850,6 @@ class CRM_Core_PseudoConstantTest extends CiviUnitTestCase {
           'fieldName' => 'visibility',
           'sample' => 'Public Pages',
         ],
-        [
-          'fieldName' => 'campaign_id',
-          'sample' => $campaign_name,
-        ],
       ],
       'CRM_Mailing_DAO_MailingComponent' => [
         [
@@ -967,10 +922,6 @@ class CRM_Core_PseudoConstantTest extends CiviUnitTestCase {
           'fieldName' => 'contribution_page_id',
           'sample' => $contribution_page,
         ],
-        [
-          'fieldName' => 'campaign_id',
-          'sample' => $campaign_name,
-        ],
       ],
       'CRM_Contribute_DAO_PremiumsProduct' => [
         [
@@ -992,10 +943,6 @@ class CRM_Core_PseudoConstantTest extends CiviUnitTestCase {
           'sample' => ['USD' => 'US Dollar'],
           'max' => 200,
         ],
-        [
-          'fieldName' => 'campaign_id',
-          'sample' => $campaign_name,
-        ],
       ],
       'CRM_Case_DAO_Case' => [
         [
index 49d0500a21091cbf8aabbd07e4f861eedd2e3724..fbcc2897148a8be0c720cf705a29f2fd4f83db8c 100644 (file)
@@ -574,7 +574,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
   public function testExportPseudoFieldCampaign() {
     $this->setUpContributionExportData();
     $campaign = $this->callAPISuccess('Campaign', 'create', ['title' => 'Big campaign and kinda long too']);
-    $this->callAPISuccess('Contribution', 'create', ['campaign_id' => 'Big_campaign_and_kinda_long_too', 'id' => $this->contributionIDs[0]]);
+    $this->callAPISuccess('Contribution', 'create', ['campaign_id' => $campaign['id'], 'id' => $this->contributionIDs[0]]);
     $selectedFields = [
       ['contact_type' => 'Individual', 'name' => 'gender_id'],
       ['contact_type' => 'Contribution', 'name' => 'contribution_campaign_title'],