Merge pull request #4789 from totten/master-test-tx
[civicrm-core.git] / tests / phpunit / api / v3 / ContactTypeTest.php
index 177c0d96b874f880cf304f54f18a93a47b6ba461..63a64da32f7225c124221c7dcc5dd51baf6d25bb 100644 (file)
@@ -39,6 +39,7 @@ class api_v3_ContactTypeTest extends CiviUnitTestCase {
 
   function setUp() {
     parent::setUp();
+    $this->useTransaction(TRUE);
     $this->_apiversion = 3;
     $params = array(
       'label' => 'sub_individual',
@@ -49,7 +50,6 @@ class api_v3_ContactTypeTest extends CiviUnitTestCase {
     );
     $result = CRM_Contact_BAO_ContactType::add($params);
     $this->subTypeIndividual = $params['name'];
-    $this->_subTypeIndividualId = $result->id;
 
     $params = array(
       'label' => 'sub_organization',
@@ -60,7 +60,6 @@ class api_v3_ContactTypeTest extends CiviUnitTestCase {
     );
     $result = CRM_Contact_BAO_ContactType::add($params);
     $this->subTypeOrganization = $params['name'];
-    $this->_subTypeOrganizationId = $result->id;
 
     $params = array(
       'label' => 'sub_household',
@@ -71,23 +70,6 @@ class api_v3_ContactTypeTest extends CiviUnitTestCase {
     );
     $result = CRM_Contact_BAO_ContactType::add($params);
     $this->subTypeHousehold = $params['name'];
-    $this->_subTypeHouseholdId = $result->id;
-  }
-
-  /**
-   * Tears down the fixture, for example, closes a network connection.
-   * This method is called after a test is executed.
-   *
-   */
-  function tearDown() {
-    $contactTypeIds = array(
-      $this->_subTypeIndividualId,
-      $this->_subTypeOrganizationId,
-      $this->_subTypeHouseholdId,
-    );
-    foreach ($contactTypeIds as $typeId) {
-      $this->contactTypeDelete($typeId);
-    }
   }
 
   /**