[NFC] CRM-19033 improve standardisation of tests
authoreileen <emcnaughton@wikimedia.org>
Wed, 6 Jul 2016 01:16:00 +0000 (13:16 +1200)
committereileen <emcnaughton@wikimedia.org>
Wed, 6 Jul 2016 01:16:00 +0000 (13:16 +1200)
NB jenkins is doing wierd things here so trying a small subset to see what jenkins does

tests/phpunit/CRM/Contact/BAO/ContactTest.php
tests/phpunit/CRM/Contact/BAO/ContactType/ContactSearchTest.php
tests/phpunit/CRM/Contact/BAO/ContactType/RelationshipTest.php
tests/phpunit/CRM/Contact/BAO/GroupContactTest.php
tests/phpunit/CRM/Contribute/BAO/ContributionPageTest.php
tests/phpunit/CRM/Core/BAO/CustomFieldTest.php
tests/phpunit/CRM/Core/BAO/EmailTest.php
tests/phpunit/CRM/Core/BAO/OpenIDTest.php
tests/phpunit/CRM/Dedupe/DedupeFinderTest.php
tests/phpunit/CiviTest/CiviUnitTestCase.php
tests/phpunit/CiviTest/Membership.php [deleted file]

index e398cfc9c72860d67368d688fa627e2ddb3943e1..a6e7a66f7f2d2f7f7c1dfc09f00cf21b69165a8f 100644 (file)
@@ -1,8 +1,5 @@
 <?php
 
-require_once 'CiviTest/Contact.php';
-require_once 'CiviTest/Custom.php';
-
 /**
  * Class CRM_Contact_BAO_ContactTest
  * @group headless
index 978d0376f331b5b51ba4d9a63d0a07e7a616579b..5e8ca244d3b47db5b1a2ed3510eddfeab6d8b6f8 100644 (file)
@@ -1,7 +1,5 @@
 <?php
 
-require_once 'CiviTest/Contact.php';
-
 /**
  * Class CRM_Contact_BAO_ContactType_ContactSearchTest
  * @group headless
index fad3f9982d95cefc2b6dd8615dc08c96064d46da..be47ad9c4dff53a82c47c878d8e02fe955b31217 100644 (file)
@@ -1,7 +1,5 @@
 <?php
 
-require_once 'CiviTest/Contact.php';
-
 /**
  * Class CRM_Contact_BAO_ContactType_RelationshipTest
  * @group headless
index 3e624ac3e218a44562b6717eff78d2d41f44b8d0..d0d18c14376e529a50caeb2a7fca8a0cc39cd52b 100644 (file)
@@ -25,8 +25,6 @@
  +--------------------------------------------------------------------+
  */
 
-require_once 'CiviTest/Contact.php';
-
 /**
  * Test class for CRM_Contact_BAO_GroupContact BAO
  *
index 7c85355c24bd22b3f287e8c85672e0f895887a3d..a9d0f5891fcfec31972ed670954353d76e32d789 100644 (file)
@@ -25,8 +25,6 @@
  +--------------------------------------------------------------------+
  */
 
-require_once 'CiviTest/Contact.php';
-require_once 'CiviTest/ContributionPage.php';
 require_once 'CiviTest/Custom.php';
 require_once 'CiviTest/PaypalPro.php';
 
index 015bff2dd03ccf9b4705907ad17000687a362db9..e0159e8791293310e66960207aaf5e3b55abad4b 100644 (file)
@@ -1,6 +1,5 @@
 <?php
 
-require_once 'CiviTest/Contact.php';
 require_once 'CiviTest/Custom.php';
 
 /**
index f6d008b4c7b43169a07a9f8482816acc9a967547..39c4d879ebeba3de6383394d064be01113da6b7a 100644 (file)
@@ -1,7 +1,5 @@
 <?php
 
-require_once 'CiviTest/Contact.php';
-
 /**
  * Class CRM_Core_BAO_EmailTest
  * @group headless
index 765aedc4fe8502c585499fac19894125c8db1748..ffa02b7af137cb8bd475f0856724444f3976804c 100644 (file)
@@ -1,7 +1,5 @@
 <?php
 
-require_once 'CiviTest/Contact.php';
-
 /**
  * Class CRM_Core_BAO_OpenIDTest
  * @group headless
index 4799a4f4a0456bac031929f3fb81ca94a8b9af82..7bc67795999de2db6a472aa4f18f344e2dfe508a 100644 (file)
@@ -1,7 +1,5 @@
 <?php
 
-require_once 'CiviTest/Contact.php';
-
 /**
  * Class CRM_Dedupe_DedupeFinderTest
  * @group headless
index a62f04531dae7bbf1e60af059307f2a7dff23cdf..887c8066d41cb4f55afba9ec4af12dbe5e7c1e13 100644 (file)
@@ -3308,8 +3308,9 @@ AND    ( TABLE_NAME LIKE 'civicrm_value_%' )
    */
   protected function createParticipantWithContribution() {
     // creating price set, price field
-    $this->_contactId = Contact::createIndividual();
-    $this->_eventId = Event::create($this->_contactId);
+    $this->_contactId = $this->individualCreate();
+    $event = $this->eventCreate();
+    $this->_eventId = $event['id'];
     $eventParams = array(
       'id' => $this->_eventId,
       'financial_type_id' => 4,
diff --git a/tests/phpunit/CiviTest/Membership.php b/tests/phpunit/CiviTest/Membership.php
deleted file mode 100644 (file)
index 5ec005d..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-<?php
-require_once 'Contact.php';
-
-/**
- * Class Membership
- */
-class Membership extends PHPUnit_Framework_Testcase {
-  /**
-   * Helper function to create membership type.
-   */
-  public function createMembershipType() {
-    $orgId = Contact::createOrganisation();
-
-    $ids = array('memberOfContact' => $orgId);
-
-    $params = array(
-      'name' => 'Test Type',
-      'description' => 'test membership type',
-      'minimum_fee' => 111,
-      'duration_unit' => 'year',
-      'period_type' => 'rolling',
-      'duration_interval' => 1,
-      'member_org' => NULL,
-      'fixed_period_start_day' => NULL,
-      'fixed_period_rollover_day' => NULL,
-      'action' => 1,
-      'financial_type_id' => 1,
-      'relationship_type_id' => 4,
-      'visibility' => 'Public',
-      'weight' => 4,
-      'is_active' => 1,
-      'contact_check' => 1,
-      'relationship_direction' => 'a_b',
-      'member_of_contact_id' => $orgId,
-    );
-
-    $membershipType = CRM_Member_BAO_MembershipType::add($params, $ids);
-    $membershipType->orgnizationID = $orgId;
-    return $membershipType;
-  }
-
-  /**
-   * Helper function to create membership block for contribution page.
-   * @param $membershipType
-   * @param $contributionPageId
-   * @return $this
-   */
-  public function createMembershipBlock($membershipType, $contributionPageId) {
-    $param = array(
-      'is_active' => 1,
-      'new_title' => 'Membership Fees',
-      'new_text' => 'text for membership fees',
-      'renewal_title' => 'Membership Renewal title',
-      'renewal_text' => 'Membership renewal text',
-      'is_required' => 1,
-      'display_min_fee' => 1,
-      'membership_type' => array(
-        $membershipType => 1,
-      ),
-      'membership_type_default' => NULL,
-      'membership_types' => $membershipType,
-      'is_separate_payment' => 0,
-      'entity_table' => 'civicrm_contribution_page',
-      'entity_id' => $contributionPageId,
-    );
-
-    $dao = new CRM_Member_DAO_MembershipBlock();
-    $dao->copyValues($param);
-    return $dao->save();
-  }
-
-  /**
-   * Helper function to delete the membership block.
-   * @param $blcokId
-   */
-  public function deleteMembershipBlock($blcokId) {
-    $dao = new CRM_Member_DAO_MembershipBlock();
-    $dao->id = $blcokId;
-    if ($dao->find(TRUE)) {
-      $dao->delete();
-    }
-  }
-
-}