Пример #1
0
 public function testUnwrapLegacy()
 {
     $body = "ERR: 301, Some Error";
     $clickatell = new Decoder($body, 200);
     $this->setExpectedException('Exception', 'Some Error', 301);
     $return = $clickatell->unwrapLegacy();
 }
Пример #2
0
 public function testSendMessage()
 {
     $default = array('to' => "12345,123456", 'text' => 'message', 'mo' => false, 'callback' => true);
     $clickatell = $this->getMockBuilder('Clickatell\\Api\\ClickatellHttp')->setMethods(array('get'))->disableOriginalConstructor()->getMock();
     $response = new Decoder('ID: 123456789 To: 12345', 200);
     $clickatell->expects($this->once())->method('get')->with('http/sendmsg', $default)->will($this->returnValue($response->unwrapLegacy()));
     $entries = $clickatell->sendMessage(array(12345, 123456), "message", array('mo' => false));
     $this->assertSame("123456789", $entries[0]->id);
     $this->assertEquals(12345, $entries[0]->destination);
     $this->assertSame(false, $entries[0]->errorCode);
     $this->assertSame(false, $entries[0]->error);
 }