Skip to content

Commit

Permalink
Update MakesAssertions.php (#1149)
Browse files Browse the repository at this point in the history
Add optional parameter to MakesAssertions/assertDontSeeIn $ignoreCase
  • Loading branch information
kenny08gt authored Nov 7, 2024
1 parent 2f09011 commit c667db6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Concerns/MakesAssertions.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,12 @@ public function assertSee($text, $ignoreCase = false)
* Assert that the given text is not present on the page.
*
* @param string $text
* @param bool $ignoreCase
* @return $this
*/
public function assertDontSee($text)
public function assertDontSee($text, $ignoreCase = false)
{
return $this->assertDontSeeIn('', $text);
return $this->assertDontSeeIn('', $text, $ignoreCase);
}

/**
Expand Down Expand Up @@ -191,16 +192,17 @@ public function assertSeeIn($selector, $text, $ignoreCase = false)
*
* @param string $selector
* @param string $text
* @param bool $ignoreCase
* @return $this
*/
public function assertDontSeeIn($selector, $text)
public function assertDontSeeIn($selector, $text, $ignoreCase = false)
{
$fullSelector = $this->resolver->format($selector);

$element = $this->resolver->findOrFail($selector);

PHPUnit::assertFalse(
Str::contains($element->getText(), $text),
Str::contains($element->getText(), $text, $ignoreCase),
"Saw unexpected text [{$text}] within element [{$fullSelector}]."
);

Expand Down

0 comments on commit c667db6

Please sign in to comment.