Skip to content

Commit

Permalink
Merge pull request #5 from QuadraEcommerce/fix-contains-empty-value
Browse files Browse the repository at this point in the history
Fix "contains" assertions with an empty value
  • Loading branch information
squatto authored Jun 2, 2023
2 parents ddb6d41 + 4a08fe0 commit d8de21e
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 d8de21e

Please sign in to comment.