示例#1
0
 /**
  * @test
  * @expectedException \InvalidArgumentException
  */
 public function cannot_use_unknown_command()
 {
     $client = new CustomClient(400, array(), '{"success": "false"}');
     $client->someInvalidCommand();
 }
 /**
  * @test
  */
 public function can_set_logger()
 {
     $client = new CustomClient();
     $client->setLogger(new NullLogger());
     $this->assertTrue(true);
 }
 /**
  * @test
  */
 public function can_return_errors_in_result()
 {
     try {
         $result = json_encode(array("success" => false, "error_description" => array("error1", "error2")));
         $client = new CustomClient(400, array(), $result);
         $client->run();
     } catch (\PortaText\Exception\ClientError $e) {
         $this->assertEquals($e->getResult()->errors(), array("error1", "error2"));
     }
 }