@@ -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,8 +114,7 @@ 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. ' );
@@ -140,14 +128,13 @@ public function testUtilsOptimizeTableFalseOptimizeDatabaseDebugFalse()
140128 $ util = (new Database ())->loadUtils ($ this ->db );
141129 $ this ->setPrivateProperty ($ util , 'optimizeTable ' , false );
142130
143- // set debug to false -- WARNING this change will persist!
144- $ this ->setPrivateProperty ( $ this -> db , ' DBDebug ' , false );
131+ // WARNING this value will persist! take care to roll it back.
132+ $ this ->disableDBDebug ( );
145133
146134 $ result = $ util ->optimizeDatabase ();
147135 $ this ->assertFalse ($ result );
148136
149- // restore original value grabbed from testFirst -- WARNING this change will persist!
150- $ this ->setPrivateProperty ($ this ->db , 'DBDebug ' , self ::$ origDebug );
137+ $ this ->enableDBDebug ();
151138 }
152139
153140 public function testUtilsOptimizeTable ()
0 commit comments