Exemplo n.º 1
0
 /**
  * Build query params array for SmsInterface
  *
  * @param \PromoSMS\Api\Sms\SmsInterface $sms
  * @return array
  */
 protected function buildSmsQueryParams(SmsInterface $sms)
 {
     $params = array('login' => $this->login, 'pass' => $this->password, 'to' => $sms->getReceiver(), 'message' => $sms->getMessage(), 'type' => $sms->getType(), 'return' => 'xml');
     if (!$sms->isSingle()) {
         $params['single'] = 0;
     }
     if ($sms->isPl()) {
         $params['pl'] = 1;
     }
     if ($sms->hasTime()) {
         $params['time'] = $sms->getTime();
     }
     return $params;
 }
Exemplo n.º 2
0
 /**
  * @param \PromoSMS\Api\Sms\SmsInterface $sms
  */
 function it_throws_exception_when_sending_sms_with_empty_message($sms)
 {
     $sms->getReceiver()->shouldBeCalled()->willReturn('111111111');
     $sms->getMessage()->shouldBeCalled()->willReturn('');
     $this->shouldThrow(new \InvalidArgumentException("Cant send sms with empty message"))->during('send', array($sms));
 }