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

  Coverage
  Classes Functions / Methods Lines
Total
0.00% 0 / 1
75.00% 3 / 4 CRAP
81.25% 13 / 16
MSXML30ProcessorDriver
0.00% 0 / 1
75.00% 3 / 4 7.32
81.25% 13 / 16
 isAvailable()
0.00% 0 / 1 4.25
75.00% 9 / 12
 getCommandTemplate()
100.00% 1 / 1 1
100.00% 2 / 2
 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 "MSXML 3.0"                                                                                                 
      18                 :  *                                                                                                                        
      19                 :  * @author Viktor Mašíček <viktor@masicek.net>                                                                         
      20                 :  */                                                                                                                       
      21                 : class MSXML30ProcessorDriver 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 :         if (PHP_OS == self::OS_WIN)                                                                                       
      33               4 :         {                                                                                                                 
      34               4 :             exec('cscript //nologo "' . __DIR__ . '\MSXMLAvailability.js" "3.0"', $output);                               
      35                 :                                                                                                                           
      36               4 :             if (count($output) == 0)                                                                                      
      37               4 :             {                                                                                                             
      38               0 :                 return FALSE;                                                                                             
      39                 :             }                                                                                                             
      40                 :             else                                                                                                          
      41                 :             {                                                                                                             
      42               4 :                 $output = $output[0];                                                                                     
      43               4 :                 if ($output == 'available')                                                                               
      44               4 :                 {                                                                                                         
      45               4 :                     return TRUE;                                                                                          
      46                 :                 }                                                                                                         
      47                 :                 else                                                                                                      
      48                 :                 {                                                                                                         
      49               0 :                     return FALSE;                                                                                         
      50                 :                 }                                                                                                         
      51                 :             }                                                                                                             
      52                 :         }                                                                                                                 
      53                 :         else                                                                                                              
      54                 :         {                                                                                                                 
      55               0 :             return FALSE;                                                                                                 
      56                 :         }                                                                                                                 
      57                 :     }                                                                                                                     
      58                 :                                                                                                                           
      59                 :                                                                                                                           
      60                 :     /**                                                                                                                   
      61                 :      * Return template of command                                                                                         
      62                 :      *                                                                                                                    
      63                 :      * Templates substitutions:                                                                                           
      64                 :      * [XSLT] = path of XSLT template for transformation                                                                  
      65                 :      * [INPUT] = path of input XML file                                                                                   
      66                 :      * [OUTPUT] = path of generated output XML file                                                                       
      67                 :      * [ERROR] = path of file for eventual generated error message                                                        
      68                 :      * [LIBS] = path of directory containing XSLT processors (libraries, command-line program etc.)                       
      69                 :      *                                                                                                                    
      70                 :      * @return string                                                                                                     
      71                 :      */                                                                                                                   
      72                 :     public function getCommandTemplate()                                                                                  
      73                 :     {                                                                                                                     
      74               2 :         $commandTemplate = 'cscript //nologo "[PROCESSORS]\MSXML\msxml.js" "[INPUT]" "[XSLT]" "[OUTPUT]" "[ERROR]" "3.0"';
      75               2 :         return $commandTemplate;                                                                                          
      76                 :     }                                                                                                                     
      77                 :                                                                                                                           
      78                 :                                                                                                                           
      79                 :     /**                                                                                                                   
      80                 :      * Full name of processor (with version)                                                                              
      81                 :      *                                                                                                                    
      82                 :      * @return string                                                                                                     
      83                 :      */                                                                                                                   
      84                 :     public function getFullName()                                                                                         
      85                 :     {                                                                                                                     
      86               3 :         return 'MSXML 3.0';                                                                                               
      87                 :     }                                                                                                                     
      88                 :                                                                                                                           
      89                 :                                                                                                                           
      90                 :     /**                                                                                                                   
      91                 :      * Return name of processor kernel.                                                                                   
      92                 :      * Available kernels are const of this class with prefix "KERNEL_"                                                    
      93                 :      *                                                                                                                    
      94                 :      * Examples:                                                                                                          
      95                 :      * Saxon 6.5.5 -> Saxon                                                                                               
      96                 :      * xsltproc -> libxslt                                                                                                
      97                 :      *                                                                                                                    
      98                 :      * @return string                                                                                                     
      99                 :      */                                                                                                                   
     100                 :     public function getKernel()                                                                                           
     101                 :     {                                                                                                                     
     102               1 :         return self::KERNEL_MSXML;                                                                                        
     103                 :     }                                                                                                                     
     104                 :                                                                                                                           
     105                 :                                                                                                                           
     106                 : }                                                                                                                         


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