public function testCatchException()
 {
     $message = 'Test catchException()';
     try {
         throw new \Exception($message);
     } catch (\Exception $e) {
         $this->_exceptionHandler->catchException($e);
     } finally {
         $errorArray = IController::getErrorArray();
         $errorIndex = count($errorArray) - 1;
         $errorArray = $errorArray[$errorIndex];
         $this->assertEquals($errorArray['message'], $message);
     }
 }
Пример #2
0
 /**
  * Returns formated error array
  *
  * @return array
  */
 private function loadLogDisplay() : array
 {
     $array = array();
     $count = 1;
     foreach (IController::getErrorArray() as $value) {
         $array[] = "#{$count} [{$value['type']}]";
         $array[] = "    {$value['message']} in {$value['file']} " . "on line {$value['line']}";
         ++$count;
         if (!empty($value['trace'])) {
             $array[] = "    [Backtrace]:";
             foreach ($value['trace'] as $trace) {
                 $message = str_replace("\n", "\n            ", $trace['message']);
                 $array[] = "        {$message}";
                 $array[] = "              IN: {$trace['file']}";
                 $array[] = "              ARGUMENTS:";
                 $array[] = "                  " . str_replace("\n", "\n                  ", $trace['arguments']);
             }
         }
         $array[] = "\n";
     }
     return array('errors' => implode("\n", $array), 'errorsCount' => $count - 1);
 }
Пример #3
0
 private function getErrorArray()
 {
     $errorArray = IController::getErrorArray();
     $errorIndex = count($errorArray) - 1;
     return $errorArray[$errorIndex];
 }
Пример #4
0
 /**
  * @return array
  */
 private function getErrorArray() : array
 {
     return IController::getErrorArray();
 }