Exemplo n.º 1
0
 public function testDecodeRest()
 {
     $body = json_encode(array('data' => true));
     $clickatell = new Decoder($body, 200);
     $return = $clickatell->decodeRest();
     $this->assertTrue($return);
     $body = json_encode(array('error' => array('description' => 'Some Error', 'code' => 301)));
     $clickatell = new Decoder($body, 200);
     $this->setExpectedException('Exception', 'Some Error', 301);
     $return = $clickatell->decodeRest();
 }
Exemplo n.º 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);
 }