8000 Dump specific key of the response (#38468) · laravel/framework@081f467 · GitHub
[go: up one dir, main page]

Skip to content

Commit 081f467

Browse files
authored
Dump specific key of the response (#38468)
1 parent 1f07d75 commit 081f467

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Illuminate/Testing/TestResponse.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,9 +1349,10 @@ protected function session()
13491349
/**
13501350
* Dump the content from the response.
13511351
*
1352+
* @param string|null $key
13521353
* @return $this
13531354
*/
1354-
public function dump()
1355+
public function dump($key = null)
13551356
{
13561357
$content = $this->getContent();
13571358

@@ -1361,7 +1362,11 @@ public function dump()
13611362
$content = $json;
13621363
}
13631364

1364-
dump($content);
1365+
if (! is_null($key)) {
1366+
dump(data_get($content, $key));
1367+
} else {
1368+
dump($content);
1369+
}
13651370

13661371
return $this;
13671372
}

0 commit comments

Comments
 (0)
0