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

  Coverage
  Classes Functions / Methods Lines
Total
0.00%0.00%
0.00% 0 / 1
66.67%66.67%
66.67% 2 / 3
86.96%86.96%
86.96% 20 / 23
 
CommentController
0.00%0.00%
0.00% 0 / 1
66.67%66.67%
66.67% 2 / 3
86.96%86.96%
86.96% 20 / 23
 public function init()
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 2 / 2
 public function indexAction()
0.00%0.00%
0.00% 0 / 1
70.00%70.00%
70.00% 7 / 10
 public function sendCommentAction()
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 10 / 10


       1                 : <?php                                                           
       2                 : class CommentController extends Zend_Controller_Action          
       3               1 : {                                                               
       4                 :     protected $_session;                                        
       5                 :                                                                     
       6                 :     public function init()                                      
       7                 :     {                                                           
       8               8 :         $this->_session = new Zend_Session_Namespace('comment');
       9               8 :     }                                                           
      10                 :                                                                 
      11                 :     public function indexAction()                               
      12                 :     {                                                           
      13               1 :         $form = new Application_Form_Comment(array (            
      14               1 :             'action' => $this->_helper->url('send-comment'),    
      15               1 :             'method' => 'POST',                                 
      16               1 :         ));                                                     
      17               1 :         if (isset ($this->_session->commentForm)) {             
      18               0 :             $form = unserialize($this->_session->commentForm);  
      19               0 :             unset ($this->_session->commentForm);               
      20               0 :         }                                                       
      21               1 :         $this->view->form = $form;                              
      22               1 :     }                                                           
      23                 :                                                                 
      24                 :     public function sendCommentAction()                         
      25                 :     {                                                           
      26               7 :         $request = $this->getRequest();                         
      27               7 :         if (!$request->isPost()) {                              
      28               1 :             return $this->_helper->redirector('index');         
      29                 :         }                                                       
      30               6 :         $form = new Application_Form_Comment();                 
      31               6 :         if (!$form->isValid($request->getPost())) {             
      32               5 :             $this->_session->commentForm = serialize($form);    
      33               5 :             return $this->_helper->redirector('index');         
      34                 :         }                                                       
      35               1 :         $values = $form->getValues();                           
      36               1 :         $this->view->values = $values;                          
      37               1 :     }                                                           
      38                 : }                                                               
      39                 :                                                                 
      40                 :                                                                 
      41                 :                                                                 

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.