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

[Feature] Apply View Assertions to Mailables and Notifications #13

Open
peterfox opened this issue Apr 30, 2020 · 1 comment
Open

[Feature] Apply View Assertions to Mailables and Notifications #13

peterfox opened this issue Apr 30, 2020 · 1 comment

Comments

@peterfox
Copy link
Contributor

I've been playing with the concept that it might be useful to use the view assertions with notification emails and mailables when doing assertions on them in tests, giving devs the ability to render them and perform further assertions on the content produced.

An example of how this would work as an API would be:

Notifications::fake();

$user->notify(new Example());

Notification::assertSentTo($user, ViewAssertion::make(function (ViewAssertion $assertion) {
    $assertion->contains('Hello World');

    return true;
}); 
Mail::fake();

(new ExampleMailable)->send();

Mail::assertSent(ExampleMailable::class, ViewAssertion::make(function (ViewAssertion $assertion) {
    $assertion->contains('Hello World');

    return true;
});

I already have a rough but working implementation if you think it'd be worth while adding to Mojito?

@peterfox peterfox changed the title [Feature] Apply View Assertions to Mailable and Notifications [Feature] Apply View Assertions to Mailables and Notifications Apr 30, 2020
@nunomaduro
Copy link
Owner

Sure. Make a pull request, and update the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants