2
2
3
3
namespace NotificationChannels \PusherPushNotifications \Test ;
4
4
5
- use Mockery ;
6
- use Pusher \Pusher ;
7
- use PHPUnit_Framework_TestCase ;
8
5
use Illuminate \Events \Dispatcher ;
6
+ use Illuminate \Notifications \Events \NotificationFailed ;
9
7
use Illuminate \Notifications \Notifiable ;
10
8
use Illuminate \Notifications \Notification ;
11
- use Illuminate \Notifications \Events \NotificationFailed ;
9
+ use Mockery ;
10
+ use Mockery \Adapter \Phpunit \MockeryTestCase ;
12
11
use NotificationChannels \PusherPushNotifications \PusherChannel ;
13
12
use NotificationChannels \PusherPushNotifications \PusherMessage ;
13
+ use Pusher \Pusher ;
14
14
15
- class ChannelTest extends PHPUnit_Framework_TestCase
15
+ class ChannelTest extends MockeryTestCase
16
16
{
17
- public function setUp ()
17
+ public function setUp (): void
18
18
{
19
19
$ this ->pusher = Mockery::mock (Pusher::class);
20
20
@@ -27,21 +27,14 @@ public function setUp()
27
27
$ this ->notifiable = new TestNotifiable ;
28
28
}
29
29
30
- public function tearDown ()
31
- {
32
- Mockery::close ();
33
-
34
- parent ::tearDown ();
35
- }
36
-
37
30
/** @test */
38
31
public function it_can_send_a_notification ()
39
32
{
40
33
$ message = $ this ->notification ->toPushNotification ($ this ->notifiable );
41
34
42
35
$ data = $ message ->toArray ();
43
36
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 ]);
45
38
46
39
$ this ->channel ->send ($ this ->notifiable , $ this ->notification );
47
40
}
@@ -53,7 +46,7 @@ public function it_fires_failure_event_on_failure()
53
46
54
47
$ data = $ message ->toArray ();
55
48
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 ]);
57
50
58
51
$ this ->events ->shouldReceive ('fire ' )->with (Mockery::type (NotificationFailed::class));
59
52
0 commit comments