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

[5.7] NotificationFake can assert preferred locale #26205

Merged

Conversation

derekmd
Copy link
Contributor

@derekmd derekmd commented Oct 21, 2018

When a notifiable implements the HasLocalePreference interface, NotificationFake should make the expected locale available for assertions.

e.g.,

Notification::fake();

$user = factory(User::class)->create(['locale' => 'au']);

// Call an artisan console command that invokes:
Notification::send($user, new AFLTrade('Chad Wingard', 'Hawthorn'));

Notification::assertSentTo($user, AFLTrade::class, function ($notification, $channels, $notifiable, $locale) use ($user) {
    return $notification->player === 'Chad Wingard' &&
        $notification->club === 'Hawthorn' &&
        $notifiable->is($user) &&
        $locale === 'au';
});

MailFake already supports similar locale assertion capabilities so I added a test for that too.

When a notifiable implements the HasLocalePreference
interface, make the NotificationFake store the locale
for assertions.

Add a similar feature test for MailFake that already
supports the same assertion capabilities.
@taylorotwell taylorotwell merged commit 2aa4c6e into laravel:5.7 Oct 22, 2018
@derekmd derekmd deleted the notification-fake-can-assert-locale branch October 22, 2018 19:05
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

Successfully merging this pull request may close these issues.

2 participants