Esempio n. 1
0
 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());
 }
Esempio n. 2
0
 public function testBasic__construct()
 {
     $e = new Exception('test');
     $o = new ErrorProcessor($e);
     $this->assertInstanceOf(\Exception::class, $o->getModel()->getException());
     $this->assertInstanceOf(ErrorMap::class, $o->getMap());
     $this->assertEquals('templates', basename($o->getMap()->getTemplatePath()));
     $this->assertEquals('error.tpl.php', $o->getMap()->getTemplate());
 }
Esempio n. 3
0
 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);
 }