From c3f02666992a25fdb8c321c24b1b16ca4ac4a9ca Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Wed, 13 Aug 2014 13:13:20 -0400 Subject: [PATCH] Remove foreign key checks for mysql tests, so test tables can be truncated --- application/third_party/CIUnit/libraries/Fixture.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/application/third_party/CIUnit/libraries/Fixture.php b/application/third_party/CIUnit/libraries/Fixture.php index 5f83eaf..d7ace8f 100755 --- a/application/third_party/CIUnit/libraries/Fixture.php +++ b/application/third_party/CIUnit/libraries/Fixture.php @@ -20,6 +20,12 @@ class Fixture { { exit('can\'t load fixture library class when not in test mode!'); } + + // Turn off foreign key checks for mysql so test tables can be easily truncated + if (getenv('DB') === 'mysql') + { + $this->CI->db->simple_query('SET foreign_key_checks = 0;'); + } } /**