예제 #1
0
 public function testGetErrorResponse()
 {
     $o = new RESTController();
     $Exception = new ExceptionController();
     $oResponse = $o->getErrorResponse($Exception);
     $this->assertInstanceOf(HttpResponse::class, $oResponse);
     $this->assertInstanceOf(HttpResponseA::class, $oResponse);
     $this->assertEquals(HttpResponseType::INTERNAL_ERROR, $oResponse->getStatus());
     $this->assertNotEquals(HttpResponseType::OK, $oResponse->getStatus());
     $sOutput = $oResponse->getOutput();
     $this->assertNotEmpty($sOutput);
     $oOutput = json_decode($sOutput);
     $this->assertInstanceOf(\stdClass::class, $oOutput);
     $this->assertObjectHasAttribute('message', $oOutput);
     $this->assertEquals('', $oOutput->message);
 }