Zend Framework Unit Test Demo
Current file: /Users/dragonbe/workspace/zfunittest/application/controllers/ErrorController.php
Legend: executed not executed dead code

  Coverage
  Classes Functions / Methods Lines
Total
0.00%0.00%
0.00% 0 / 1
0.00%0.00%
0.00% 0 / 2
0.00%0.00%
0.00% 0 / 27
 
ErrorController
0.00%0.00%
0.00% 0 / 1
0.00%0.00%
0.00% 0 / 2
0.00%0.00%
0.00% 0 / 27
 public function errorAction()
0.00%0.00%
0.00% 0 / 1
0.00%0.00%
0.00% 0 / 21
 public function getLog()
0.00%0.00%
0.00% 0 / 1
0.00%0.00%
0.00% 0 / 5


       1                 : <?php                                                                         
       2                 :                                                                               
       3                 : class ErrorController extends Zend_Controller_Action                          
       4               0 : {                                                                             
       5                 :                                                                               
       6                 :     public function errorAction()                                             
       7                 :     {                                                                         
       8               0 :         $errors = $this->_getParam('error_handler');                          
       9                 :                                                                                       
      10               0 :         switch ($errors->type) {                                              
      11               0 :             case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE:     
      12               0 :             case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
      13               0 :             case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:    
      14                 :                                                                                       
      15                 :                 // 404 error -- controller or action not found                
      16               0 :                 $this->getResponse()->setHttpResponseCode(404);               
      17               0 :                 $this->view->message = 'Page not found';                      
      18               0 :                 break;                                                        
      19               0 :             default:                                                          
      20                 :                 // application error                                          
      21               0 :                 $this->getResponse()->setHttpResponseCode(500);               
      22               0 :                 $this->view->message = 'Application error';                   
      23               0 :                 break;                                                        
      24               0 :         }                                                                     
      25                 :                                                                                       
      26                 :         // Log exception, if logger available                                 
      27               0 :         if ($log = $this->getLog()) {                                         
      28               0 :             $log->crit($this->view->message, $errors->exception);             
      29               0 :         }                                                                     
      30                 :                                                                                       
      31                 :         // conditionally display exceptions                                   
      32               0 :         if ($this->getInvokeArg('displayExceptions') == true) {               
      33               0 :             $this->view->exception = $errors->exception;                      
      34               0 :         }                                                                     
      35                 :                                                                                       
      36               0 :         $this->view->request   = $errors->request;                            
      37               0 :     }                                                                         
      38                 :                                                                               
      39                 :     public function getLog()                                                  
      40                 :     {                                                                         
      41               0 :         $bootstrap = $this->getInvokeArg('bootstrap');                        
      42               0 :         if (!$bootstrap->hasPluginResource('Log')) {                          
      43               0 :             return false;                                                     
      44                 :         }                                                                     
      45               0 :         $log = $bootstrap->getResource('Log');                                
      46               0 :         return $log;                                                          
      47                 :     }                                                                         
      48                 :                                                                               
      49                 :                                                                               
      50                 : }                                                                             
      51                 :                                                                               

Generated by PHPUnit 3.4.15 and Xdebug 2.1.0 using PHP 5.3.2 at Tue Sep 21 9:29:58 CEST 2010.