/** * @covers Devtools\Response::message() * @expectedException \Exception **/ public function testMessageFail() { $validResponse = json_encode(array('status' => '', 'request' => array(), 'message' => 'Error.' . "\n")); $responseFail = new \Devtools\Response(); $responseFail->message("Error.", true); $this->assertEquals($validResponse, $responseFail->json()); }
<?php $resp = new \Devtools\Response(); $resp->data($_REQUEST); $resp->message('This is a successful json call with which to test.'); echo $resp->json();
<?php require_once 'autoloader.php'; $resp = new \Devtools\Response(); $resp->data($_REQUEST); $resp->message('This is a failed json call for testing.'); echo $resp->json();