From e07bd15be0ffce489f5592c8c2095697e2006097 Mon Sep 17 00:00:00 2001 From: Chrysanthos Date: Fri, 20 Aug 2021 16:29:55 +0300 Subject: [PATCH] Dump specific key of the response --- src/Illuminate/Testing/TestResponse.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Testing/TestResponse.php b/src/Illuminate/Testing/TestResponse.php index 90930a1d7464..3e46e7a17161 100644 --- a/src/Illuminate/Testing/TestResponse.php +++ b/src/Illuminate/Testing/TestResponse.php @@ -1349,9 +1349,10 @@ protected function session() /** * Dump the content from the response. * + * @param string|null $key * @return $this */ - public function dump() + public function dump($key = null) { $content = $this->getContent(); @@ -1361,7 +1362,11 @@ public function dump() $content = $json; } - dump($content); + if (! is_null($key)) { + dump(data_get($content, $key)); + } else { + dump($content); + } return $this; }