From 80c39186b4e6875fe5c78342c63b5d9334e0b22d Mon Sep 17 00:00:00 2001 From: Dries Vints Date: Mon, 27 Apr 2020 15:33:18 +0200 Subject: [PATCH 1/2] Fix boolean value in assertSessionHasErrors --- src/Illuminate/Foundation/Testing/TestResponse.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Illuminate/Foundation/Testing/TestResponse.php b/src/Illuminate/Foundation/Testing/TestResponse.php index b2a5487b1805..2873db0732a8 100644 --- a/src/Illuminate/Foundation/Testing/TestResponse.php +++ b/src/Illuminate/Foundation/Testing/TestResponse.php @@ -1029,6 +1029,10 @@ public function assertSessionHasErrors($keys = [], $format = null, $errorBag = ' if (is_int($key)) { PHPUnit::assertTrue($errors->has($value), "Session missing error: $value"); } else { + if (is_bool($value)) { + $value = (string) $value; + } + PHPUnit::assertContains($value, $errors->get($key, $format)); } } From 209f6e2f9626a2a968af4c53a6376d9b0fbe7ba3 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Mon, 27 Apr 2020 08:53:16 -0500 Subject: [PATCH 2/2] Update TestResponse.php --- src/Illuminate/Foundation/Testing/TestResponse.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Illuminate/Foundation/Testing/TestResponse.php b/src/Illuminate/Foundation/Testing/TestResponse.php index 2873db0732a8..e906b3aa15c4 100644 --- a/src/Illuminate/Foundation/Testing/TestResponse.php +++ b/src/Illuminate/Foundation/Testing/TestResponse.php @@ -1029,11 +1029,7 @@ public function assertSessionHasErrors($keys = [], $format = null, $errorBag = ' if (is_int($key)) { PHPUnit::assertTrue($errors->has($value), "Session missing error: $value"); } else { - if (is_bool($value)) { - $value = (string) $value; - } - - PHPUnit::assertContains($value, $errors->get($key, $format)); + PHPUnit::assertContains(is_bool($value) ? (string) $value : $value, $errors->get($key, $format)); } }