coreResponse = new PhalApi_Response_Json_Mock(); } protected function tearDown() { } /** * @group testSetRet */ public function testSetRet() { $ret = '0'; $rs = $this->coreResponse->setRet($ret); } /** * @group testSetData */ public function testSetData() { $data = array('sth' => 'hi~'); $rs = $this->coreResponse->setData($data); } /** * @group testSetMsg */ public function testSetMsg() { $msg = 'this will shoul as a wrong msg'; $rs = $this->coreResponse->setMsg($msg); } /** * @group testAddHeaders */ public function testAddHeaders() { $key = 'Content-Type'; $content = 'text/html;charset=utf-8'; $rs = $this->coreResponse->addHeaders($key, $content); } public function testGetHeaders() { $key = 'Version'; $content = '1.1.2'; $rs = $this->coreResponse->addHeaders($key, $content); $this->assertEquals($content, $this->coreResponse->getHeaders($key)); $this->assertTrue(is_array($this->coreResponse->getHeaders())); } /** * @group testOutput */ public function testOutput() { $this->coreResponse->setRet(404); $this->coreResponse->setMsg('not found'); $this->coreResponse->setData(array('name' => 'PhalApi')); $rs = $this->coreResponse->output(); $this->expectOutputString('{"ret":404,"data":{"name":"PhalApi"},"msg":"not found"}'); } }