Пример #1
0
 public function testShouldDispatchNotifyEvent()
 {
     $manager = $this->prophesize(NotificationManagerInterface::class);
     $manager->notify(Argument::type(Sms::class))->shouldBeCalled();
     $sms = new Sms();
     $sms->setManager($manager->reveal());
     $sms->send();
 }
Пример #2
0
 /**
  * @dataProvider right
  *
  * @expectedException \Fazland\Notifire\Exception\NotificationFailedException
  *
  * @param Sms $sms
  */
 public function testNotifyShouldCallSkebbySendReceiveFailingResponseAndThrowNotificationFailedException(Sms $sms)
 {
     $skebbySms = SkebbySms::create()->setRecipients($sms->getTo())->setText($sms->getContent());
     $response = new Response(self::RESPONSE_FAIL);
     $this->skebby->send($skebbySms)->shouldBeCalled();
     $this->skebby->send($skebbySms)->willReturn([$response]);
     $this->handler->notify($sms);
     /** @var Result $result */
     foreach ($sms->getResultSet()->all() as $result) {
         $this->assertTrue(Result::FAIL === $result->getResult());
     }
 }
Пример #3
0
 /**
  * Get the parameters for the messages->create call
  *
  * @param Sms $notification
  *
  * @return array
  */
 protected function getData(Sms $notification)
 {
     return ['From' => $notification->getFrom() ?: $this->defaultFrom, 'Body' => $notification->getContent()];
 }
Пример #4
0
 public function right()
 {
     $sms = new Sms();
     $sms->setTo(['+393333333333'])->setFrom('+393333333333')->setContent('Foo Bar');
     return [[$sms]];
 }