CiviUnitTestCase - Remove foreignKeyChecksOff
authorTim Otten <totten@civicrm.org>
Fri, 29 Jan 2016 05:47:40 +0000 (21:47 -0800)
committerTim Otten <totten@civicrm.org>
Tue, 2 Feb 2016 04:56:23 +0000 (21:56 -0700)
This function appears to do the opposite of what it says (ie it sets
`foreign_key_checks=1`).  And there doesn't seem to be anything that
sets `foreign_key_checks=0` which would need to be cancelled-out.

tests/phpunit/CRM/Contact/Form/Search/Custom/GroupTest.php
tests/phpunit/CRM/Contact/Form/Search/Custom/SampleTest.php
tests/phpunit/CRM/Report/Form/Contribute/DetailTest.php
tests/phpunit/CRM/Report/Form/TestCaseTest.php
tests/phpunit/CiviTest/CiviUnitTestCase.php
tests/phpunit/api/v3/CustomValueTest.php

index 17c19c7d6c655f295583c8161a42f2bc68c061dc..a338bc7de6708d9fa0131e7f9d66492550392e1a 100644 (file)
@@ -89,8 +89,6 @@ class CRM_Contact_Form_Search_Custom_GroupTest extends CiviUnitTestCase {
    * @throws \Exception
    */
   public function testCount($fv, $count, $ids, $full) {
-    $this->foreignKeyChecksOff();
-
     $this->quickCleanup($this->_tablesToTruncate);
 
     // echo "testCount\n";
index 53c0339b9e75a11ae65b97f0ea33e075e4d7f234..8b72f3dde77d83eb7c0b8b1da0ac36aeb3bb0766 100644 (file)
@@ -84,8 +84,6 @@ class CRM_Contact_Form_Search_Custom_SampleTest extends CiviUnitTestCase {
    * @throws \Exception
    */
   public function testCount($fv, $count, $ids, $full) {
-    $this->foreignKeyChecksOff();
-
     $this->quickCleanup($this->_tablesToTruncate);
 
     // echo "testCount\n";
index 698609a891fb376516eb45beb7b8f8786a45fcc9..e1ac068ab6ddbd36c0b131176eecd2dc43a3bae9 100644 (file)
@@ -69,7 +69,6 @@ class CRM_Report_Form_Contribute_DetailTest extends CiviReportTestCase {
 
   public function setUp() {
     parent::setUp();
-    $this->foreignKeyChecksOff();
     $this->quickCleanup($this->_tablesToTruncate);
   }
 
index 83488a31e801df8477a4cbd8eb0d4b85c83d0c82..406aef8b67be65c0a0f34fa383676b47513cfcef 100644 (file)
@@ -131,7 +131,6 @@ class CRM_Report_Form_TestCaseTest extends CiviReportTestCase {
 
   public function setUp() {
     parent::setUp();
-    $this->foreignKeyChecksOff();
     $this->quickCleanup($this->_tablesToTruncate);
   }
 
index e3369d995bc3705f1c117f837aeccd2142f49f4d..8016a45a178e6cdc5ac0929e5d6694cccaa7c74d 100755 (executable)
@@ -519,25 +519,6 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase {
     $this->clearOutputBuffer();
   }
 
-  /**
-   *  FIXME: Maybe a better way to do it
-   */
-  public function foreignKeyChecksOff() {
-    self::$utils = new Utils(CIVICRM_DSN);
-    $dbName = self::getDBName();
-    $query = "USE {$dbName};" . "SET foreign_key_checks = 1";
-    if (self::$utils->do_query($query) === FALSE) {
-      // fail happens
-      echo 'Cannot set foreign_key_checks = 0';
-      exit(1);
-    }
-    return TRUE;
-  }
-
-  public function foreignKeyChecksOn() {
-    // FIXME: might not be needed if previous fixme implemented
-  }
-
   /**
    * Generic function to compare expected values after an api call to retrieved.
    * DB values.
index b1fa3cb66d008394a3d938377a8ec854e018a82f..33b961171d47acd801dcb03b850290d7f69050bb 100644 (file)
@@ -111,7 +111,6 @@ class api_v3_CustomValueTest extends CiviUnitTestCase {
       switch ($dataType) {
         case 'Country':
         case 'StateProvince':
-          $this->foreignKeyChecksOff();
         case 'String':
         case 'Link':
         case 'Int':