22
33namespace NotificationChannels \PusherPushNotifications \Test ;
44
5- use Mockery ;
6- use Pusher \Pusher ;
7- use PHPUnit_Framework_TestCase ;
85use Illuminate \Events \Dispatcher ;
6+ use Illuminate \Notifications \Events \NotificationFailed ;
97use Illuminate \Notifications \Notifiable ;
108use Illuminate \Notifications \Notification ;
11- use Illuminate \Notifications \Events \NotificationFailed ;
9+ use Mockery ;
10+ use Mockery \Adapter \Phpunit \MockeryTestCase ;
1211use NotificationChannels \PusherPushNotifications \PusherChannel ;
1312use NotificationChannels \PusherPushNotifications \PusherMessage ;
13+ use Pusher \Pusher ;
1414
15- class ChannelTest extends PHPUnit_Framework_TestCase
15+ class ChannelTest extends MockeryTestCase
1616{
17- public function setUp ()
17+ public function setUp (): void
1818 {
1919 $ this ->pusher = Mockery::mock (Pusher::class);
2020
@@ -27,21 +27,14 @@ public function setUp()
2727 $ this ->notifiable = new TestNotifiable ;
2828 }
2929
30- public function tearDown ()
31- {
32- Mockery::close ();
33-
34- parent ::tearDown ();
35- }
36-
3730 /** @test */
3831 public function it_can_send_a_notification ()
3932 {
4033 $ message = $ this ->notification ->toPushNotification ($ this ->notifiable );
4134
4235 $ data = $ message ->toArray ();
4336
44- $ this ->pusher ->shouldReceive ('notify ' )->with ('interest_name ' , $ data , true )->andReturn (['status ' => 202 ]);
37+ $ this ->pusher ->shouldReceive ('notify ' )->with ([ 'interest_name ' ] , $ data , true )->andReturn (['status ' => 202 ]);
4538
4639 $ this ->channel ->send ($ this ->notifiable , $ this ->notification );
4740 }
@@ -53,7 +46,7 @@ public function it_fires_failure_event_on_failure()
5346
5447 $ data = $ message ->toArray ();
5548
56- $ this ->pusher ->shouldReceive ('notify ' )->with ('interest_name ' , $ data , true )->andReturn (['status ' => 500 ]);
49+ $ this ->pusher ->shouldReceive ('notify ' )->with ([ 'interest_name ' ] , $ data , true )->andReturn (['status ' => 500 ]);
5750
5851 $ this ->events ->shouldReceive ('fire ' )->with (Mockery::type (NotificationFailed::class));
5952
0 commit comments