Skip to content

Commit 82e48d0

Browse files
committed
Fold Session panel into Request panel
Having a separate for just session data seems redundant when session data is always accessed through the request.
1 parent 2464c4d commit 82e48d0

6 files changed

Lines changed: 17 additions & 8 deletions

File tree

src/Panel/RequestPanel.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public function shutdown(EventInterface $event): void
5555
'data' => Debugger::exportVarAsNodes($request->getData(), $maxDepth),
5656
'cookie' => Debugger::exportVarAsNodes($request->getCookieParams(), $maxDepth),
5757
'get' => Debugger::exportVarAsNodes($_GET, $maxDepth),
58+
'session' => Debugger::exportVarAsNodes($request->getSession()->read(), $maxDepth),
5859
'matchedRoute' => $request->getParam('_matchedRoute'),
5960
'headers' => [
6061
'response' => headers_sent($file, $line),

src/Panel/SessionPanel.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Cake\Error\Debugger;
1919
use Cake\Event\EventInterface;
2020
use DebugKit\DebugPanel;
21+
use function Cake\Core\deprecationWarning;
2122

2223
/**
2324
* Provides debug information on the Session contents.
@@ -32,6 +33,7 @@ class SessionPanel extends DebugPanel
3233
*/
3334
public function shutdown(EventInterface $event): void
3435
{
36+
deprecationWarning('5.1.0', 'SessionPanel is deprecated. Remove it from your panel list, and use Request panel instead.');
3537
/** @var \Cake\Controller\Controller $controller */
3638
$controller = $event->getSubject();
3739
$request = $controller->getRequest();

src/ToolbarService.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ class ToolbarService
5555
protected array $_defaultConfig = [
5656
'panels' => [
5757
'DebugKit.Cache' => true,
58-
'DebugKit.Session' => true,
5958
'DebugKit.Request' => true,
6059
'DebugKit.SqlLog' => true,
6160
'DebugKit.Timer' => true,

tests/TestCase/Middleware/DebugKitMiddlewareTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,10 @@ public function testInvokeSaveData()
126126
$this->assertSame(200, $result->status_code);
127127
$this->assertGreaterThan(1, $result->panels);
128128

129-
$this->assertSame('SqlLog', $result->panels[11]->panel);
130-
$this->assertSame('DebugKit.sql_log_panel', $result->panels[11]->element);
129+
$this->assertSame('Timer', $result->panels[11]->panel);
130+
$this->assertSame('DebugKit.timer_panel', $result->panels[11]->element);
131131
$this->assertNotNull($result->panels[11]->summary);
132-
$this->assertSame('Sql Log', $result->panels[11]->title);
132+
$this->assertSame('Timer', $result->panels[11]->title);
133133

134134
$timeStamp = filectime(Plugin::path('DebugKit') . 'webroot' . DS . 'js' . DS . 'inject-iframe.js');
135135

tests/TestCase/Panel/RequestPanelTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ public function testShutdownSkipAttributes()
6464

6565
$data = $this->panel->data();
6666
$this->assertArrayHasKey('attributes', $data);
67+
$this->assertArrayHasKey('session', $data);
68+
$this->assertArrayHasKey('params', $data);
69+
$this->assertArrayHasKey('data', $data);
70+
$this->assertArrayHasKey('cookie', $data);
6771
$this->assertEquals('string', $data['attributes']['ok']->getType());
6872
$this->assertStringContainsString('Could not serialize `closure`', $data['attributes']['closure']->getValue());
6973
}

tests/TestCase/ToolbarServiceTest.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,10 +256,13 @@ public function testSaveData()
256256
$this->assertSame(200, $result->status_code);
257257
$this->assertGreaterThan(1, $result->panels);
258258

259-
$this->assertSame('SqlLog', $result->panels[11]->panel);
260-
$this->assertSame('DebugKit.sql_log_panel', $result->panels[11]->element);
261-
$this->assertSame('0', $result->panels[11]->summary);
262-
$this->assertSame('Sql Log', $result->panels[11]->title);
259+
$this->assertSame('Timer', $result->panels[11]->panel);
260+
$this->assertSame('DebugKit.timer_panel', $result->panels[11]->element);
261+
$this->assertMatchesRegularExpression(
262+
'/\d+\.\d+\s[ms]+\s+\/\s+\d+\.\d+\s+[mbMB]+/',
263+
$result->panels[11]->summary
264+
);
265+
$this->assertSame('Timer', $result->panels[11]->title);
263266
}
264267

265268
/**

0 commit comments

Comments
 (0)