コード例 #1
0
 /**
  * @test
  */
 public function sendsRequest()
 {
     $gateway = new ClickatellGateway('lussavain', 'lussuta', 'tussia', 'http://api.dr-kobros.com');
     $browser = $this->getMockBuilder('Buzz\\Browser')->disableOriginalConstructor()->getMock();
     $gateway->setClient($browser);
     $browser->expects($this->once())->method('post')->with('http://api.dr-kobros.com/http/sendmsg?api_id=lussavain&user=lussuta&password='******'tussia&to=358503028030&text=Pekkis+tassa+lussuttaa.&from=358503028030', array());
     $message = new \Xi\Sms\SmsMessage('Pekkis tassa lussuttaa.', '358503028030', '358503028030');
     $ret = $gateway->send($message);
     $this->assertTrue($ret);
 }
コード例 #2
0
 /**
  * @test
  */
 public function sendsRequest()
 {
     $gateway = new ClickatellGateway('lussavain', 'lussuta', 'tussia', 'http://api.dr-kobros.com');
     $browser = $this->getMockBuilder('Buzz\\Browser')->disableOriginalConstructor()->getMock();
     $gateway->setClient($browser);
     $browser->expects($this->once())->method('get')->with($this->callback(function ($actual) {
         $url = parse_url($actual);
         parse_str($url['query'], $query);
         return $url['scheme'] === 'http' && $url['host'] === 'api.dr-kobros.com' && $url['path'] === '/http/sendmsg' && $query['api_id'] === 'lussavain' && $query['user'] === 'lussuta' && $query['password'] === 'tussia' && $query['to'] === '358503028030' && urldecode($query['text']) === 'Pekkis tassa lussuttaa.' && $query['from'] === '358503028030';
     }), array())->will($this->returnValue('ID: QWERTYUI12345678'));
     $message = new \Xi\Sms\SmsMessage('Pekkis tassa lussuttaa.', '358503028030', '358503028030');
     $ret = $gateway->send($message);
     $this->assertEquals('QWERTYUI12345678', $ret);
 }