for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace NotificationChannels\FortySixElks\Test;
use Illuminate\Notifications\Notifiable;
use Illuminate\Notifications\Notification;
use Mockery;
use NotificationChannels\FortySixElks\FortySixElksChannel;
use NotificationChannels\FortySixElks\FortySixElksSMS;
class FortySixElksChannelTest extends \PHPUnit_Framework_TestCase
{
protected $dispatcher;
protected $channel;
protected $notifiable;
protected $notification;
protected $smsMessage;
public function setUp()
parent::setUp();
$this->dispatcher = new \Illuminate\Events\Dispatcher();
$this->channel = new FortySixElksChannel($this->dispatcher);
$this->smsMessage = Mockery::mock(FortySixElksSMS::class);
$this->notifiable = new TestNotifiable();
$this->notification = new TestNotification($this->smsMessage);
}
public function testItCanBeInstantiatedTest()
$this->assertInstanceOf(FortySixElksChannel::class, $this->channel);
public function testCanSendNotification()
$this->smsMessage->shouldReceive('send')
->once()
->andReturn($this->smsMessage);
$this->notification->to46Elks($this->notifiable);
$response = $this->channel->send($this->notifiable, $this->notification);
$this->assertInstanceOf(FortySixElksSMS::class, $response);
class TestNotifiable
use Notifiable;
Illuminate\Notifications\Notifiable
NotificationChannels\For...lks\Test\TestNotifiable
$email
$phone_number
class TestNotification extends Notification
public function __construct($message)
$this->message = $message;
message
public function to46Elks($notifiable)
$notifiable
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function to46Elks(/** @scrutinizer ignore-unused */ $notifiable)
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
return $this->message;