Overview

Namespaces

  • Budovy
  • Kdyby
    • BootstrapFormRenderer
      • DI
      • Latte
  • Nette
    • Application
      • Diagnostics
      • Responses
      • Routers
      • UI
    • Caching
      • Storages
    • ComponentModel
    • Database
      • Diagnostics
      • Drivers
      • Reflection
      • Table
    • DI
      • Config
        • Adapters
      • Diagnostics
      • Extensions
    • Diagnostics
    • Forms
      • Controls
      • Rendering
    • Http
      • Diagnostics
    • Iterators
    • Latte
      • Macros
    • Loaders
    • Localization
    • Mail
    • PhpGenerator
    • Reflection
    • Security
      • Diagnostics
    • Templating
    • Utils
  • NetteModule
  • Nextras
    • Datagrid
  • None
  • PHP
  • Tester
    • CodeCoverage
    • Runner
      • Output
  • Vodacek
    • Forms
      • Controls
  • WebLoader
    • Filter
    • Nette

Classes

  • CommandLine
  • Job
  • PhpExecutable
  • Runner
  • TestHandler

Interfaces

  • OutputHandler
  • Overview
  • Namespace
  • Class
  • Tree
 1: <?php
 2: 
 3: /**
 4:  * This file is part of the Nette Tester.
 5:  * Copyright (c) 2009 David Grudl (http://davidgrudl.com)
 6:  */
 7: 
 8: namespace Tester\Runner;
 9: 
10: 
11: /**
12:  * PHP executable command-line.
13:  *
14:  * @author     David Grudl
15:  */
16: class PhpExecutable
17: {
18:     /** @var string  PHP arguments */
19:     public $arguments;
20: 
21:     /** @var string  PHP executable */
22:     private $path;
23: 
24:     /** @var string  PHP version */
25:     private $version;
26: 
27:     /** @var bool is CGI? */
28:     private $cgi;
29: 
30: 
31:     public function __construct($path, $args = NULL)
32:     {
33:         $this->path = \Tester\Helpers::escapeArg($path);
34:         $descriptors = array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w'));
35:         $proc = @proc_open("$this->path -n -v", $descriptors, $pipes);
36:         $output = stream_get_contents($pipes[1]);
37:         $error = stream_get_contents($pipes[2]);
38:         if (proc_close($proc)) {
39:             throw new \Exception("Unable to run '$path': " . preg_replace('#[\r\n ]+#', ' ', $error));
40:         } elseif (!preg_match('#^PHP (\S+).*c(g|l)i#i', $output, $matches)) {
41:             throw new \Exception("Unable to detect PHP version (output: $output).");
42:         }
43: 
44:         $this->version = $matches[1];
45:         $this->cgi = strcasecmp($matches[2], 'g') === 0;
46:         $this->arguments = $args;
47:     }
48: 
49: 
50:     /**
51:      * @return string
52:      */
53:     public function getCommandLine()
54:     {
55:         return $this->path/* . ' ' . $this->arguments*/;
56:     }
57: 
58: 
59:     /**
60:      * @return string
61:      */
62:     public function getVersion()
63:     {
64:         return $this->version;
65:     }
66: 
67: 
68:     /**
69:      * @return bool
70:      */
71:     public function isCgi()
72:     {
73:         return $this->cgi;
74:     }
75: 
76: }
77: 
API documentation generated by ApiGen 2.8.0