Skip to content

Commit

Permalink
Test a notification can be instructed to be queued
Browse files Browse the repository at this point in the history
  • Loading branch information
unclexo committed Jan 19, 2023
1 parent 6aab4fb commit 9c9ce26
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/Notifications/OrderShipmentNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;

class OrderShipmentNotification extends Notification
class OrderShipmentNotification extends Notification implements ShouldQueue
{
use Queueable;

Expand Down
10 changes: 10 additions & 0 deletions tests/Feature/NotificationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use App\Models\User;
use App\Notifications\OrderShipmentNotification;
use Illuminate\Auth\Notifications\ResetPassword;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Notifications\Messages\MailMessage;
Expand Down Expand Up @@ -88,4 +89,13 @@ public function password_can_be_reset_with_valid_token()
return true;
});
}

/** @test */
public function a_notification_can_be_instructed_to_be_queued()
{
$this->assertInstanceOf(
ShouldQueue::class,
app(OrderShipmentNotification::class)
);
}
}

0 comments on commit 9c9ce26

Please sign in to comment.