From 26c476db8aed75dbe390fd43ea84fa9a08a97691 Mon Sep 17 00:00:00 2001 From: Noboru Shiroiwa <14008307+nshiro@users.noreply.github.com> Date: Tue, 13 Dec 2022 00:42:38 +0900 Subject: [PATCH] [9.x] Improve assertSeeText and assertDontSeeText test methods (#45274) --- src/Illuminate/Testing/TestResponse.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Illuminate/Testing/TestResponse.php b/src/Illuminate/Testing/TestResponse.php index 52acab73beda..b6a96f5483bb 100644 --- a/src/Illuminate/Testing/TestResponse.php +++ b/src/Illuminate/Testing/TestResponse.php @@ -621,11 +621,11 @@ public function assertSeeText($value, $escape = true) $values = $escape ? array_map('e', ($value)) : $value; - tap(strip_tags($this->getContent()), function ($content) use ($values) { - foreach ($values as $value) { - PHPUnit::assertStringContainsString((string) $value, $content); - } - }); + $content = strip_tags($this->getContent()); + + foreach ($values as $value) { + PHPUnit::assertStringContainsString((string) $value, $content); + } return $this; } @@ -679,11 +679,11 @@ public function assertDontSeeText($value, $escape = true) $values = $escape ? array_map('e', ($value)) : $value; - tap(strip_tags($this->getContent()), function ($content) use ($values) { - foreach ($values as $value) { - PHPUnit::assertStringNotContainsString((string) $value, $content); - } - }); + $content = strip_tags($this->getContent()); + + foreach ($values as $value) { + PHPUnit::assertStringNotContainsString((string) $value, $content); + } return $this; }