1 | <?php |
||||
2 | |||||
3 | namespace NotificationChannels\FortySixElks\Test; |
||||
4 | |||||
5 | use Illuminate\Notifications\Notifiable; |
||||
6 | use Illuminate\Notifications\Notification; |
||||
7 | use Mockery; |
||||
8 | use NotificationChannels\FortySixElks\FortySixElksChannel; |
||||
9 | use NotificationChannels\FortySixElks\FortySixElksSMS; |
||||
10 | |||||
11 | class FortySixElksChannelTest extends \PHPUnit_Framework_TestCase |
||||
12 | { |
||||
13 | protected $dispatcher; |
||||
14 | |||||
15 | protected $channel; |
||||
16 | |||||
17 | protected $notifiable; |
||||
18 | |||||
19 | protected $notification; |
||||
20 | |||||
21 | protected $smsMessage; |
||||
22 | |||||
23 | public function setUp() |
||||
24 | { |
||||
25 | parent::setUp(); |
||||
26 | $this->dispatcher = new \Illuminate\Events\Dispatcher(); |
||||
27 | |||||
28 | $this->channel = new FortySixElksChannel($this->dispatcher); |
||||
29 | |||||
30 | $this->smsMessage = Mockery::mock(FortySixElksSMS::class); |
||||
31 | |||||
32 | $this->notifiable = new TestNotifiable(); |
||||
33 | |||||
34 | $this->notification = new TestNotification($this->smsMessage); |
||||
35 | } |
||||
36 | |||||
37 | public function testItCanBeInstantiatedTest() |
||||
38 | { |
||||
39 | $this->assertInstanceOf(FortySixElksChannel::class, $this->channel); |
||||
40 | } |
||||
41 | |||||
42 | public function testCanSendNotification() |
||||
43 | { |
||||
44 | $this->smsMessage->shouldReceive('send') |
||||
45 | ->once() |
||||
46 | ->andReturn($this->smsMessage); |
||||
47 | |||||
48 | $this->notification->to46Elks($this->notifiable); |
||||
49 | $response = $this->channel->send($this->notifiable, $this->notification); |
||||
50 | |||||
51 | $this->assertInstanceOf(FortySixElksSMS::class, $response); |
||||
52 | } |
||||
53 | } |
||||
54 | |||||
55 | class TestNotifiable |
||||
56 | { |
||||
57 | use Notifiable; |
||||
0 ignored issues
–
show
introduced
by
Loading history...
|
|||||
58 | } |
||||
59 | |||||
60 | class TestNotification extends Notification |
||||
61 | { |
||||
62 | public function __construct($message) |
||||
63 | { |
||||
64 | $this->message = $message; |
||||
0 ignored issues
–
show
|
|||||
65 | } |
||||
66 | |||||
67 | public function to46Elks($notifiable) |
||||
0 ignored issues
–
show
The parameter
$notifiable is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
Loading history...
|
|||||
68 | { |
||||
69 | return $this->message; |
||||
70 | } |
||||
71 | } |
||||
72 |