@@ -39,6 +39,7 @@ class DebugKitMiddlewareTest extends TestCase
3939 'plugin.debug_kit.requests ' ,
4040 'plugin.debug_kit.panels '
4141 ];
42+
4243 /**
4344 * setup
4445 *
@@ -50,6 +51,19 @@ public function setUp()
5051
5152 $ connection = ConnectionManager::get ('test ' );
5253 $ this ->skipIf ($ connection ->getDriver () instanceof Sqlite, 'Schema insertion/removal breaks SQLite ' );
54+ $ this ->oldConfig = Configure::read ('DebugKit ' );
55+ }
56+
57+ /**
58+ * tearDown
59+ *
60+ * @return void
61+ */
62+ public function tearDown ()
63+ {
64+ parent ::tearDown ();
65+
66+ Configure::write ('DebugKit ' , $ this ->oldConfig );
5367 }
5468
5569 /**
@@ -205,4 +219,20 @@ public function testInvokeNoModifyRequestAction()
205219 $ body = $ result ->getBody ();
206220 $ this ->assertNotContains ('<script ' , '' . $ body );
207221 }
222+
223+ /**
224+ * Test that configuration is correctly passed to the service
225+ *
226+ * @return void
227+ */
228+ public function testConfigIsPassed ()
229+ {
230+ $ config = ['foo ' => 'bar ' ];
231+ Configure::write ('DebugKit ' , $ config );
232+ $ layer = new DebugKitMiddleware ();
233+ $ prop = new \ReflectionProperty (DebugKitMiddleware::class, 'service ' );
234+ $ prop ->setAccessible (true );
235+ $ service = $ prop ->getValue ($ layer );
236+ $ this ->assertEquals ('bar ' , $ service ->getConfig ('foo ' ));
237+ }
208238}
0 commit comments