Skip to content

Commit ce564ba

Browse files
authored
Merge pull request #855 from cakephp/add-attributes
add attributes to request tab
2 parents a0516c9 + 28a363f commit ce564ba

File tree

4 files changed

+27
-19
lines changed

4 files changed

+27
-19
lines changed

src/Panel/RequestPanel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function shutdown(EventInterface $event)
3434
$controller = $event->getSubject();
3535
$request = $controller->getRequest();
3636
$this->_data = [
37-
'params' => $request->getAttribute('params'),
37+
'attributes' => $request->getAttributes(),
3838
'query' => $request->getQueryParams(),
3939
'data' => $request->getData(),
4040
'cookie' => $request->getCookieParams(),

templates/element/request_panel.php

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,47 +19,53 @@
1919
/**
2020
* @var \DebugKit\View\AjaxView $this
2121
* @var array $headers
22-
* @var array $params
22+
* @var array $attributes
2323
* @var array $data
2424
* @var array $query
2525
* @var array $cookie
2626
* @var string $matchedRoute
2727
*/
2828
?>
29-
<?php if (!empty($headers) && $headers['response']): ?>
29+
<?php if (!empty($headers) && $headers['response']) : ?>
3030
<h4><?= __d('debug_kit', 'Warning') ?></h4>
3131
<?= '<p class="warning">' . __d('debug_kit', 'Headers already sent at file {0} and line {1}.', [$headers['file'], $headers['line']]) . '</p>' ?>
3232
<?php endif; ?>
3333

34-
<h4><?= __d('debug_kit', 'Routing Params') ?></h4>
35-
<?= $this->Toolbar->dump($params) ?>
34+
<h4><?= __d('debug_kit', 'Attributes') ?></h4>
35+
<?php
36+
if (empty($attributes)) :
37+
echo '<p class="info">' . __d('debug_kit', 'No attributes data.') . '</p>';
38+
else :
39+
echo $this->Toolbar->dump($attributes);
40+
endif;
41+
?>
3642

3743
<h4><?= __d('debug_kit', 'Post data') ?></h4>
3844
<?php
39-
if (empty($data)):
45+
if (empty($data)) :
4046
echo '<p class="info">' . __d('debug_kit', 'No post data.') . '</p>';
41-
else:
47+
else :
4248
echo $this->Toolbar->dump($data);
4349
endif;
4450
?>
4551

4652
<h4>Query string</h4>
4753
<?php
48-
if (empty($query)):
54+
if (empty($query)) :
4955
echo '<p class="info">' . __d('debug_kit', 'No querystring data.') . '</p>';
50-
else:
56+
else :
5157
echo $this->Toolbar->dump($query);
5258
endif;
5359
?>
5460

5561
<h4>Cookie</h4>
56-
<?php if (isset($cookie)): ?>
62+
<?php if (isset($cookie)) : ?>
5763
<?= $this->Toolbar->dump($cookie) ?>
58-
<?php else: ?>
64+
<?php else : ?>
5965
<p class="info"><?= __d('debug_kit', 'No Cookie data.') ?></p>
6066
<?php endif; ?>
6167

62-
<?php if (!empty($matchedRoute)): ?>
68+
<?php if (!empty($matchedRoute)) : ?>
6369
<h4><?= __d('debug_kit', 'Matched Route') ?></h4>
6470
<p><?= $this->Toolbar->dump(['template' => $matchedRoute]) ?></p>
6571
<?php endif; ?>

tests/TestCase/Controller/PanelsControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function testView()
8383

8484
$this->assertResponseOk();
8585
$this->assertResponseContains('Request</h2>');
86-
$this->assertResponseContains('Routing Params</h4>');
86+
$this->assertResponseContains('Attributes</h4>');
8787
}
8888

8989
/**

tests/TestCase/FixtureFactoryTrait.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,14 @@ protected function makePanel($request, $name = 'DebugKit.Request', $title = 'Req
3232
{
3333
if ($content === null) {
3434
$content = [
35-
'params' => [
36-
'plugin' => null,
37-
'controller' => 'Tasks',
38-
'action' => 'add',
39-
'_ext' => null,
40-
'pass' => [],
35+
'attributes' => [
36+
'params' => [
37+
'plugin' => null,
38+
'controller' => 'Tasks',
39+
'action' => 'add',
40+
'_ext' => null,
41+
'pass' => [],
42+
],
4143
],
4244
'query' => [],
4345
'data' => [],

0 commit comments

Comments
 (0)