Xsltproc1123ProcessorDriver.php
Current file: C:\DATA\Viktor\Diplomka\XSLT-Benchmarking/XSLTBenchmarking/TestsRunner/Processors/Drivers/Xsltproc1123ProcessorDriver.php
Legend: executed not executed dead code

  Coverage
  Classes Functions / Methods Lines
Total
0.00% 0 / 1
50.00% 2 / 4 CRAP
43.48% 10 / 23
Xsltproc1123ProcessorDriver
0.00% 0 / 1
50.00% 2 / 4 23.63
43.48% 10 / 23
 isAvailable()
0.00% 0 / 1 10.75
25.00% 3 / 12
 getCommandTemplate()
0.00% 0 / 1 3.79
55.56% 5 / 9
 getFullName()
100.00% 1 / 1 1
100.00% 1 / 1
 getKernel()
100.00% 1 / 1 1
100.00% 1 / 1



       1                 : <?php                                                                                                                                  
       2                 :                                                                                                                                        
       3                 : /*                                                                                                                                     
       4                 :  * XSLT Benchmarking                                                                                                                   
       5                 :  * @link https://github.com/masicek/XSLT-Benchmarking                                                                                  
       6                 :  * @author Viktor Mašíček <viktor@masicek.net>                                                                                      
       7                 :  * @license "New" BSD License                                                                                                          
       8                 :  */                                                                                                                                    
       9                 :                                                                                                                                        
      10                 : namespace XSLTBenchmarking\TestsRunner;                                                                                                
      11                 :                                                                                                                                        
      12                 : // @codeCoverageIgnoreStart                                                                                                            
      13                 : require_once __DIR__ . '/AProcessorDriver.php';                                                                                        
      14                 : // @codeCoverageIgnoreEnd                                                                                                              
      15                 :                                                                                                                                        
      16                 : /**                                                                                                                                    
      17                 :  * Driver for "xsltproc 1.1.23"                                                                                                        
      18                 :  *                                                                                                                                     
      19                 :  * @author Viktor Mašíček <viktor@masicek.net>                                                                                      
      20                 :  */                                                                                                                                    
      21                 : class Xsltproc1123ProcessorDriver extends AProcessorDriver                                                                             
      22                 : {                                                                                                                                      
      23                 :                                                                                                                                        
      24                 :                                                                                                                                        
      25                 :     /**                                                                                                                                
      26                 :      * Return flag, if the driver is available.                                                                                        
      27                 :      *                                                                                                                                 
      28                 :      * @return bool                                                                                                                    
      29                 :      */                                                                                                                                
      30                 :     public function isAvailable()                                                                                                      
      31                 :     {                                                                                                                                  
      32               4 :         switch (PHP_OS)                                                                                                                
      33                 :         {                                                                                                                              
      34               4 :             case self::OS_WIN:                                                                                                         
      35               4 :                 return TRUE;                                                                                                           
      36                 :                 break;                                                                                                                 
      37                 :                                                                                                                                        
      38               0 :             case self::OS_LINUX:                                                                                                       
      39               0 :                 exec('xsltproc --version 2> /dev/null | grep \'libxslt 10123\' | wc -l', $output);                                     
      40               0 :                 if ($output[0] == '0')                                                                                                 
      41               0 :                 {                                                                                                                      
      42               0 :                     return FALSE;                                                                                                      
      43                 :                 }                                                                                                                      
      44                 :                 else                                                                                                                   
      45                 :                 {                                                                                                                      
      46               0 :                     return TRUE;                                                                                                       
      47                 :                 }                                                                                                                      
      48                 :                 break;                                                                                                                 
      49                 :                                                                                                                                        
      50               0 :             default:                                                                                                                   
      51               0 :                 return FALSE;                                                                                                          
      52                 :                 break;                                                                                                                 
      53               0 :         }                                                                                                                              
      54                 :     }                                                                                                                                  
      55                 :                                                                                                                                        
      56                 :                                                                                                                                        
      57                 :     /**                                                                                                                                
      58                 :      * Return template of command                                                                                                      
      59                 :      *                                                                                                                                 
      60                 :      * Templates substitutions:                                                                                                        
      61                 :      * [XSLT] = path of XSLT template for transformation                                                                               
      62                 :      * [INPUT] = path of input XML file                                                                                                
      63                 :      * [OUTPUT] = path of generated output XML file                                                                                    
      64                 :      * [ERROR] = path of file for eventual generated error message                                                                     
      65                 :      * [LIBS] = path of directory containing XSLT processors (libraries, command-line program etc.)                                    
      66                 :      *                                                                                                                                 
      67                 :      * @return string                                                                                                                  
      68                 :      */                                                                                                                                
      69                 :     public function getCommandTemplate()                                                                                               
      70                 :     {                                                                                                                                  
      71               2 :         switch (PHP_OS)                                                                                                                
      72                 :         {                                                                                                                              
      73               2 :             case self::OS_WIN:                                                                                                         
      74               2 :                 $commandTemplate = '"[PROCESSORS]\libxslt\1.1.23\xsltproc\xsltproc.exe" -o "[OUTPUT]" "[XSLT]" "[INPUT]" 2> "[ERROR]"';
      75               2 :                 break;                                                                                                                 
      76                 :                                                                                                                                        
      77               0 :             case self::OS_LINUX:                                                                                                       
      78                 :                 // we assume installing xsltproc 1.1.23                                                                                
      79               0 :                 $commandTemplate = 'xsltproc -o [OUTPUT] [XSLT] [INPUT] 2> [ERROR]';                                                   
      80               0 :                 break;                                                                                                                 
      81               0 :         }                                                                                                                              
      82                 :                                                                                                                                        
      83               2 :         return $commandTemplate;                                                                                                       
      84                 :     }                                                                                                                                  
      85                 :                                                                                                                                        
      86                 :                                                                                                                                        
      87                 :     /**                                                                                                                                
      88                 :      * Full name of processor (with version)                                                                                           
      89                 :      *                                                                                                                                 
      90                 :      * @return string                                                                                                                  
      91                 :      */                                                                                                                                
      92                 :     public function getFullName()                                                                                                      
      93                 :     {                                                                                                                                  
      94               3 :         return 'xsltproc 1.1.23';                                                                                                      
      95                 :     }                                                                                                                                  
      96                 :                                                                                                                                        
      97                 :                                                                                                                                        
      98                 :     /**                                                                                                                                
      99                 :      * Return name of processor kernel.                                                                                                
     100                 :      * Available kernels are const of this class with prefix "KERNEL_"                                                                 
     101                 :      *                                                                                                                                 
     102                 :      * Examples:                                                                                                                       
     103                 :      * Saxon 6.5.5 -> Saxon                                                                                                            
     104                 :      * xsltproc -> libxslt                                                                                                             
     105                 :      *                                                                                                                                 
     106                 :      * @return string                                                                                                                  
     107                 :      */                                                                                                                                
     108                 :     public function getKernel()                                                                                                        
     109                 :     {                                                                                                                                  
     110               1 :         return self::KERNEL_LIBXSLT;                                                                                                   
     111                 :     }                                                                                                                                  
     112                 :                                                                                                                                        
     113                 :                                                                                                                                        
     114                 : }                                                                                                                                      


Generated by PHP_CodeCoverage @package_version@ using PHP 5.3.6 and PHPUnit @package_version@ at Tue Jun 26 15:06:55 CEST 2012.