From a40c78f17f6dfa2f618e0233aa9b1950ad5d8908 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Thu, 28 Jan 2016 21:47:40 -0800 Subject: [PATCH] CiviUnitTestCase - Remove foreignKeyChecksOff 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. --- .../Contact/Form/Search/Custom/GroupTest.php | 2 -- .../Contact/Form/Search/Custom/SampleTest.php | 2 -- .../CRM/Report/Form/Contribute/DetailTest.php | 1 - .../phpunit/CRM/Report/Form/TestCaseTest.php | 1 - tests/phpunit/CiviTest/CiviUnitTestCase.php | 19 ------------------- tests/phpunit/api/v3/CustomValueTest.php | 1 - 6 files changed, 26 deletions(-) diff --git a/tests/phpunit/CRM/Contact/Form/Search/Custom/GroupTest.php b/tests/phpunit/CRM/Contact/Form/Search/Custom/GroupTest.php index 17c19c7d6c..a338bc7de6 100644 --- a/tests/phpunit/CRM/Contact/Form/Search/Custom/GroupTest.php +++ b/tests/phpunit/CRM/Contact/Form/Search/Custom/GroupTest.php @@ -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"; diff --git a/tests/phpunit/CRM/Contact/Form/Search/Custom/SampleTest.php b/tests/phpunit/CRM/Contact/Form/Search/Custom/SampleTest.php index 53c0339b9e..8b72f3dde7 100644 --- a/tests/phpunit/CRM/Contact/Form/Search/Custom/SampleTest.php +++ b/tests/phpunit/CRM/Contact/Form/Search/Custom/SampleTest.php @@ -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"; diff --git a/tests/phpunit/CRM/Report/Form/Contribute/DetailTest.php b/tests/phpunit/CRM/Report/Form/Contribute/DetailTest.php index 698609a891..e1ac068ab6 100644 --- a/tests/phpunit/CRM/Report/Form/Contribute/DetailTest.php +++ b/tests/phpunit/CRM/Report/Form/Contribute/DetailTest.php @@ -69,7 +69,6 @@ class CRM_Report_Form_Contribute_DetailTest extends CiviReportTestCase { public function setUp() { parent::setUp(); - $this->foreignKeyChecksOff(); $this->quickCleanup($this->_tablesToTruncate); } diff --git a/tests/phpunit/CRM/Report/Form/TestCaseTest.php b/tests/phpunit/CRM/Report/Form/TestCaseTest.php index 83488a31e8..406aef8b67 100644 --- a/tests/phpunit/CRM/Report/Form/TestCaseTest.php +++ b/tests/phpunit/CRM/Report/Form/TestCaseTest.php @@ -131,7 +131,6 @@ class CRM_Report_Form_TestCaseTest extends CiviReportTestCase { public function setUp() { parent::setUp(); - $this->foreignKeyChecksOff(); $this->quickCleanup($this->_tablesToTruncate); } diff --git a/tests/phpunit/CiviTest/CiviUnitTestCase.php b/tests/phpunit/CiviTest/CiviUnitTestCase.php index e3369d995b..8016a45a17 100755 --- a/tests/phpunit/CiviTest/CiviUnitTestCase.php +++ b/tests/phpunit/CiviTest/CiviUnitTestCase.php @@ -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. diff --git a/tests/phpunit/api/v3/CustomValueTest.php b/tests/phpunit/api/v3/CustomValueTest.php index b1fa3cb66d..33b961171d 100644 --- a/tests/phpunit/api/v3/CustomValueTest.php +++ b/tests/phpunit/api/v3/CustomValueTest.php @@ -111,7 +111,6 @@ class api_v3_CustomValueTest extends CiviUnitTestCase { switch ($dataType) { case 'Country': case 'StateProvince': - $this->foreignKeyChecksOff(); case 'String': case 'Link': case 'Int': -- 2.25.1