Skip to content

Commit

Permalink
[9.x] Improve assertSeeText and assertDontSeeText test methods (#45274)
Browse files Browse the repository at this point in the history
  • Loading branch information
nshiro committed Dec 12, 2022
1 parent e969ffc commit 26c476d
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/Illuminate/Testing/TestResponse.php
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 26c476d

Please sign in to comment.