22
33namespace NotificationChannels \Webhook \Test ;
44
5+ use Mockery ;
56use GuzzleHttp \Client ;
67use GuzzleHttp \Psr7 \Response ;
8+ use Orchestra \Testbench \TestCase ;
79use Illuminate \Notifications \Notification ;
8- use Mockery ;
9- use NotificationChannels \Webhook \Exceptions \CouldNotSendNotification ;
1010use NotificationChannels \Webhook \WebhookChannel ;
1111use NotificationChannels \Webhook \WebhookMessage ;
12- use Orchestra \Testbench \TestCase ;
1312
1413class ChannelTest extends TestCase
1514{
@@ -33,6 +32,7 @@ public function it_can_send_a_notification()
3332 $ channel = new WebhookChannel ($ client );
3433 $ channel ->send (new TestNotifiable (), new TestNotification ());
3534 }
35+
3636 /** @test */
3737 public function it_can_send_a_notification_with_2xx_status ()
3838 {
@@ -54,11 +54,12 @@ public function it_can_send_a_notification_with_2xx_status()
5454 $ channel ->send (new TestNotifiable (), new TestNotification ());
5555 }
5656
57- /** @test */
57+ /**
58+ * @expectedException NotificationChannels\Webhook\Exceptions\CouldNotSendNotification
59+ * @test
60+ */
5861 public function it_throws_an_exception_when_it_could_not_send_the_notification ()
5962 {
60- $ this ->setExpectedException (CouldNotSendNotification::class);
61-
6263 $ response = new Response (500 );
6364 $ client = Mockery::mock (Client::class);
6465 $ client ->shouldReceive ('post ' )
@@ -82,7 +83,6 @@ public function routeNotificationForWebhook()
8283 }
8384}
8485
85-
8686class TestNotification extends Notification
8787{
8888 public function toWebhook ($ notifiable )
0 commit comments