Browse Source

Remove foreign key checks for mysql tests, so test tables can be truncated

Timothy J. Warren 3 years ago
parent
commit
c3f0266699
1 changed files with 6 additions and 0 deletions
  1. 6 0
      application/third_party/CIUnit/libraries/Fixture.php

+ 6 - 0
application/third_party/CIUnit/libraries/Fixture.php View File

@@ -20,6 +20,12 @@ class Fixture {
20 20
 		{
21 21
 			exit('can\'t load fixture library class when not in test mode!');
22 22
 		}
23
+
24
+		// Turn off foreign key checks for mysql so test tables can be easily truncated
25
+		if (getenv('DB') === 'mysql')
26
+		{
27
+			$this->CI->db->simple_query('SET foreign_key_checks = 0;');
28
+		}
23 29
 	}
24 30
 
25 31
 	/**