|
5 | 5 | use Exception;
|
6 | 6 | use Illuminate\Contracts\Translation\HasLocalePreference;
|
7 | 7 | use Illuminate\Foundation\Auth\User;
|
| 8 | +use Illuminate\Notifications\AnonymousNotifiable; |
8 | 9 | use Illuminate\Notifications\Notification;
|
9 | 10 | use Illuminate\Support\Collection;
|
10 | 11 | use Illuminate\Support\Testing\Fakes\NotificationFake;
|
@@ -61,6 +62,22 @@ public function testAssertSentToClosure()
|
61 | 62 | });
|
62 | 63 | }
|
63 | 64 |
|
| 65 | + public function testAssertSentOnDemand() |
| 66 | + { |
| 67 | + $this->fake->send(new AnonymousNotifiable, new NotificationStub); |
| 68 | + |
| 69 | + $this->fake->assertSentOnDemand(NotificationStub::class); |
| 70 | + } |
| 71 | + |
| 72 | + public function testAssertSentOnDemandClosure() |
| 73 | + { |
| 74 | + $this->fake->send(new AnonymousNotifiable, new NotificationStub); |
| 75 | + |
| 76 | + $this->fake->assertSentOnDemand(NotificationStub::class, function (NotificationStub $notification) { |
| 77 | + return true; |
| 78 | + }); |
| 79 | + } |
| 80 | + |
64 | 81 | public function testAssertNotSentTo()
|
65 | 82 | {
|
66 | 83 | $this->fake->assertNotSentTo($this->user, NotificationStub::class);
|
@@ -134,6 +151,32 @@ public function testAssertTimesSent()
|
134 | 151 | $this->fake->assertTimesSent(3, NotificationStub::class);
|
135 | 152 | }
|
136 | 153 |
|
| 154 | + public function testAssertSentToTimes() |
| 155 | + { |
| 156 | + $this->fake->assertSentToTimes($this->user, NotificationStub::class, 0); |
| 157 | + |
| 158 | + $this->fake->send($this->user, new NotificationStub); |
| 159 | + |
| 160 | + $this->fake->send($this->user, new NotificationStub); |
| 161 | + |
| 162 | + $this->fake->send($this->user, new NotificationStub); |
| 163 | + |
| 164 | + $this->fake->assertSentToTimes($this->user, NotificationStub::class, 3); |
| 165 | + } |
| 166 | + |
| 167 | + public function testAssertSentOnDemandTimes() |
| 168 | + { |
| 169 | + $this->fake->assertSentOnDemandTimes(NotificationStub::class, 0); |
| 170 | + |
| 171 | + $this->fake->send(new AnonymousNotifiable, new NotificationStub); |
| 172 | + |
| 173 | + $this->fake->send(new AnonymousNotifiable, new NotificationStub); |
| 174 | + |
| 175 | + $this->fake->send(new AnonymousNotifiable, new NotificationStub); |
| 176 | + |
| 177 | + $this->fake->assertSentOnDemandTimes(NotificationStub::class, 3); |
| 178 | + } |
| 179 | + |
137 | 180 | public function testAssertSentToWhenNotifiableHasPreferredLocale()
|
138 | 181 | {
|
139 | 182 | $user = new LocalizedUserStub;
|
|
0 commit comments