Skip to content

Commit

Permalink
Fix "contains" assertions with an empty value
Browse files Browse the repository at this point in the history
  • Loading branch information
squatto committed Jun 2, 2023
1 parent ddb6d41 commit 4a08fe0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
}

foreach ($nodes as $node) {
if (Str::contains($node->textContent, (string) $value)) {
if ((string) $value === '' || Str::contains($node->textContent, (string) $value)) {
PHPUnit::assertTrue(true);

return $this;
Expand All @@ -105,7 +105,7 @@
}

foreach ($nodes as $node) {
if (! Str::contains($node->textContent, (string) $value)) {
if ((string) $value !== '' && ! Str::contains($node->textContent, (string) $value)) {
PHPUnit::fail("The selector '$selector' did not contain the value '$value'.");
}
}
Expand Down

0 comments on commit 4a08fe0

Please sign in to comment.