コード例 #1
0
ファイル: setExceptionTest.php プロジェクト: bogdananton/vsc
 public function testBasicSetException()
 {
     $Exception = new ExceptionError('test', 123);
     $o = new ErrorProcessor($Exception);
     $oMap = new ClassMap(ErrorProcessor::class, '.*');
     $sMessage = uniqid('MESSAGE:');
     $sCode = uniqid('CODE:');
     $iError = HttpResponseType::CLIENT_ERROR;
     $Exception = new ExceptionResponseError($sMessage, $iError);
     $o->setException($Exception);
     $this->assertInstanceOf(\vsc\domain\models\ErrorModel::class, $o->getModel());
     $this->assertEquals($sMessage, $o->getModel()->getMessage());
     $this->assertEquals($iError, $o->getModel()->getHttpStatus());
 }
コード例 #2
0
ファイル: getModelTest.php プロジェクト: bogdananton/vsc
 public function testGetException()
 {
     $Exception = new ExceptionError('test', 123);
     $o = new ErrorProcessor($Exception);
     $sMessage = uniqid('MESSAGE:');
     $iError = HttpResponseType::CLIENT_ERROR;
     $o->setException(new ExceptionResponseError($sMessage, $iError));
     $oModel = $o->getModel();
     $this->assertInstanceOf(\vsc\domain\models\ErrorModel::class, $oModel);
     $Exception = $oModel->getException();
     $this->assertInstanceOf(ExceptionResponseError::class, $Exception);
     $this->assertInstanceOf(\vsc\presentation\responses\ExceptionResponse::class, $Exception);
     $this->assertInstanceOf(\vsc\presentation\ExceptionPresentation::class, $Exception);
 }