@@ -28,17 +28,6 @@ final class DbUtilsTest extends CIUnitTestCase
2828
2929 protected $ refresh = true ;
3030 protected $ seed = CITestSeeder::class;
31- private static $ origDebug ;
32-
33- /**
34- * This test must run first to store the inital debug value before we tinker with it below
35- */
36- public function testFirst ()
37- {
38- $ this ::$ origDebug = $ this ->getPrivateProperty ($ this ->db , 'DBDebug ' );
39-
40- $ this ->assertIsBool ($ this ::$ origDebug );
41- }
4231
4332 public function testUtilsBackup ()
4433 {
@@ -125,11 +114,11 @@ public function testUtilsOptimizeTableFalseOptimizeDatabaseDebugTrue()
125114 $ util = (new Database ())->loadUtils ($ this ->db );
126115 $ this ->setPrivateProperty ($ util , 'optimizeTable ' , false );
127116
128- // set debug to true -- WARNING this change will persist!
129- $ this ->setPrivateProperty ($ this ->db , 'DBDebug ' , true );
117+ $ this ->enableDBDebug ();
130118
131119 $ this ->expectException (DatabaseException::class);
132120 $ this ->expectExceptionMessage ('Unsupported feature of the database platform you are using. ' );
121+
133122 $ util ->optimizeDatabase ();
134123
135124 // this point in code execution will never be reached
@@ -140,14 +129,13 @@ public function testUtilsOptimizeTableFalseOptimizeDatabaseDebugFalse()
140129 $ util = (new Database ())->loadUtils ($ this ->db );
141130 $ this ->setPrivateProperty ($ util , 'optimizeTable ' , false );
142131
143- // set debug to false -- WARNING this change will persist!
144- $ this ->setPrivateProperty ( $ this -> db , ' DBDebug ' , false );
132+ // WARNING this value will persist! take care to roll it back.
133+ $ this ->disableDBDebug ( );
145134
146135 $ result = $ util ->optimizeDatabase ();
147136 $ this ->assertFalse ($ result );
148137
149- // restore original value grabbed from testFirst -- WARNING this change will persist!
150- $ this ->setPrivateProperty ($ this ->db , 'DBDebug ' , self ::$ origDebug );
138+ $ this ->enableDBDebug ();
151139 }
152140
153141 public function testUtilsOptimizeTable ()
0 commit comments