Skip to content

Commit

Permalink
Allow null values
Browse files Browse the repository at this point in the history
  • Loading branch information
squatto committed Jun 2, 2023
1 parent f91fdcc commit 3acba35
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
return $this;
});

TestResponse::macro('assertSelectorContains', function (string $selector, string $value): TestResponse {
TestResponse::macro('assertSelectorContains', function (string $selector, $value): TestResponse {
/** @var DOMNodeList $nodes */
$nodes = $this->getSelectorMatches($selector);

Expand All @@ -86,7 +86,7 @@
}

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

return $this;
Expand All @@ -96,7 +96,7 @@
PHPUnit::fail("The selector '$selector' did not contain the value '$value'.");
});

TestResponse::macro('assertSelectorsAllContain', function (string $selector, string $value): TestResponse {
TestResponse::macro('assertSelectorsAllContain', function (string $selector, $value): TestResponse {
/** @var DOMNodeList $nodes */
$nodes = $this->getSelectorMatches($selector);

Expand All @@ -105,7 +105,7 @@
}

foreach ($nodes as $node) {
if (! Str::contains($node->textContent, $value)) {
if (! Str::contains($node->textContent, (string) $value)) {
PHPUnit::fail("The selector '$selector' did not contain the value '$value'.");
}
}
Expand All @@ -115,7 +115,7 @@
return $this;
});

TestResponse::macro('assertSelectorEquals', function (string $selector, string $value): TestResponse {
TestResponse::macro('assertSelectorEquals', function (string $selector, $value): TestResponse {
/** @var DOMNodeList $nodes */
$nodes = $this->getSelectorMatches($selector);

Expand All @@ -124,7 +124,7 @@
}

foreach ($nodes as $node) {
if (trim($node->textContent) === $value) {
if (trim($node->textContent) === (string) $value) {
PHPUnit::assertTrue(true);

return $this;
Expand All @@ -134,7 +134,7 @@
PHPUnit::fail("The selector '$selector' did not equal the value '$value'.");
});

TestResponse::macro('assertSelectorsAllEqual', function (string $selector, string $value): TestResponse {
TestResponse::macro('assertSelectorsAllEqual', function (string $selector, $value): TestResponse {
/** @var DOMNodeList $nodes */
$nodes = $this->getSelectorMatches($selector);

Expand All @@ -143,7 +143,7 @@
}

foreach ($nodes as $node) {
if (trim($node->textContent) !== $value) {
if (trim($node->textContent) !== (string) $value) {
PHPUnit::fail("One or more matches of the selector '$selector' did not equal the value '$value'.");
}
}
Expand All @@ -153,7 +153,7 @@
return $this;
});

TestResponse::macro('assertSelectorNotEquals', function (string $selector, string $value): TestResponse {
TestResponse::macro('assertSelectorNotEquals', function (string $selector, $value): TestResponse {
/** @var DOMNodeList $nodes */
$nodes = $this->getSelectorMatches($selector);

Expand All @@ -162,7 +162,7 @@
}

foreach ($nodes as $node) {
if (trim($node->textContent) !== $value) {
if (trim($node->textContent) !== (string) $value) {
PHPUnit::assertTrue(true);

return $this;
Expand All @@ -172,7 +172,7 @@
PHPUnit::fail("The selector '$selector' did equal the value '$value'.");
});

TestResponse::macro('assertSelectorsAllNotEqual', function (string $selector, string $value): TestResponse {
TestResponse::macro('assertSelectorsAllNotEqual', function (string $selector, $value): TestResponse {
/** @var DOMNodeList $nodes */
$nodes = $this->getSelectorMatches($selector);

Expand All @@ -181,7 +181,7 @@
}

foreach ($nodes as $node) {
if (trim($node->textContent) === $value) {
if (trim($node->textContent) === (string) $value) {
PHPUnit::fail("One or more matches of the selector '$selector' did equal the value '$value'.");
}
}
Expand Down

0 comments on commit 3acba35

Please sign in to comment.