Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] Make mailable assertions fluent #38850

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/Illuminate/Mail/Mailable.php
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ public function attachData($data, $name, array $options = [])
* Assert that the given text is present in the HTML email body.
*
* @param string $string
* @return void
* @return $this
*/
public function assertSeeInHtml($string)
{
Expand All @@ -872,13 +872,15 @@ public function assertSeeInHtml($string)
Str::contains($html, $string),
"Did not see expected text [{$string}] within email body."
);

return $this;
}

/**
* Assert that the given text is not present in the HTML email body.
*
* @param string $string
* @return void
* @return $this
*/
public function assertDontSeeInHtml($string)
{
Expand All @@ -888,13 +890,15 @@ public function assertDontSeeInHtml($string)
Str::contains($html, $string),
"Saw unexpected text [{$string}] within email body."
);

return $this;
}

/**
* Assert that the given text is present in the plain-text email body.
*
* @param string $string
* @return void
* @return $this
*/
public function assertSeeInText($string)
{
Expand All @@ -904,13 +908,15 @@ public function assertSeeInText($string)
Str::contains($text, $string),
"Did not see expected text [{$string}] within text email body."
);

return $this;
}

/**
* Assert that the given text is not present in the plain-text email body.
*
* @param string $string
* @return void
* @return $this
*/
public function assertDontSeeInText($string)
{
Expand All @@ -920,6 +926,8 @@ public function assertDontSeeInText($string)
Str::contains($text, $string),
"Saw unexpected text [{$string}] within text email body."
);

return $this;
}

/**
Expand Down