Current file: htdocs/app/code/local/Alanstormdotcom/Configviewer/Model/Observer.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 / 3 CRAP
23.53%23.53%
23.53% 4 / 17
 
Alanstormdotcom_Configviewer_Model_Observer
0.00%0.00%
0.00% 0 / 1
0.00%0.00%
0.00% 0 / 3
23.53%23.53%
23.53% 4 / 17
 checkForConfigRequest($observer)
0.00%0.00%
0.00% 0 / 1 2.50
50.00%50.00%
50.00% 3 / 6
 setHeader()
0.00%0.00%
0.00% 0 / 1 12
0.00%0.00%
0.00% 0 / 9
 outputConfig()
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1


       1                 : <?php                                                                              
       2               1 :     class Alanstormdotcom_Configviewer_Model_Observer {                            
       3                 :         const FLAG_SHOW_CONFIG = 'showConfig';                                     
       4                 :         const FLAG_SHOW_CONFIG_FORMAT = 'showConfigFormat';                        
       5                 :                                                                                    
       6                 :         private $request;                                                          
       7                 :                                                                                    
       8                 :         public function checkForConfigRequest($observer) {                         
       9               1 :             $this->request = $observer->getEvent()->getData('front')->getRequest();
      10               1 :             if($this->request->{self::FLAG_SHOW_CONFIG} === 'true'){               
      11               0 :                 $this->setHeader();                                                
      12               0 :                 $this->outputConfig();                                             
      13               0 :             }                                                                      
      14               1 :         }                                                                          
      15                 :                                                                                    
      16                 :         private function setHeader() {                                             
      17               0 :             $format = isset($this->request->{self::FLAG_SHOW_CONFIG_FORMAT}) ?     
      18               0 :             $this->request->{self::FLAG_SHOW_CONFIG_FORMAT} : 'xml';               
      19                 :             switch($format){                                                       
      20               0 :                 case 'text':                                                       
      21               0 :                     header("Content-Type: text/plain");                            
      22               0 :                     break;                                                         
      23               0 :                 default:                                                           
      24               0 :                     header("Content-Type: text/xml");                              
      25               0 :             }                                                                      
      26               0 :         }                                                                          
      27                 :                                                                                    
      28                 :         private function outputConfig() {                                          
      29               0 :             die(Mage::app()->getConfig()->getNode()->asXML());                     
      30                 :         }                                                                          

Generated by PHP_CodeCoverage 1.0.4 using PHP 5.3.4 and PHPUnit 3.5.13 at Tue Jul 5 9:07:16 UTC 2011.