X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=WEB-INF%2Flib%2Fpear%2FPEAR%2FRunTest.php;h=59dedbf9bf263a74336b67411990014a35fa9c7d;hb=90ff65cf45284f90b1c4e09fe575319b320f56ac;hp=5182490697015f3954aa05c924a80f6f58c47ed3;hpb=afe2d051307ae2cd54bdb957f04e1d9f625f2dd9;p=timetracker.git diff --git a/WEB-INF/lib/pear/PEAR/RunTest.php b/WEB-INF/lib/pear/PEAR/RunTest.php index 51824906..59dedbf9 100644 --- a/WEB-INF/lib/pear/PEAR/RunTest.php +++ b/WEB-INF/lib/pear/PEAR/RunTest.php @@ -10,7 +10,6 @@ * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: RunTest.php 313024 2011-07-06 19:51:24Z dufuz $ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.3.3 */ @@ -38,7 +37,7 @@ putenv("PHP_PEAR_RUNTESTS=1"); * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 + * @version Release: 1.10.1 * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.3.3 */ @@ -60,7 +59,6 @@ class PEAR_RunTest var $ini_overwrites = array( 'output_handler=', 'open_basedir=', - 'safe_mode=0', 'disable_functions=', 'output_buffering=Off', 'display_errors=1', @@ -75,7 +73,6 @@ class PEAR_RunTest 'error_append_string=', 'auto_prepend_file=', 'auto_append_file=', - 'magic_quotes_runtime=0', 'xdebug.default_enable=0', 'allow_url_fopen=1', ); @@ -84,7 +81,7 @@ class PEAR_RunTest * An object that supports the PEAR_Common->log() signature, or null * @param PEAR_Common|null */ - function PEAR_RunTest($logger = null, $options = array()) + function __construct($logger = null, $options = array()) { if (!defined('E_DEPRECATED')) { define('E_DEPRECATED', 0); @@ -115,19 +112,11 @@ class PEAR_RunTest function system_with_timeout($commandline, $env = null, $stdin = null) { $data = ''; - if (version_compare(phpversion(), '5.0.0', '<')) { - $proc = proc_open($commandline, array( - 0 => array('pipe', 'r'), - 1 => array('pipe', 'w'), - 2 => array('pipe', 'w') - ), $pipes); - } else { - $proc = proc_open($commandline, array( - 0 => array('pipe', 'r'), - 1 => array('pipe', 'w'), - 2 => array('pipe', 'w') - ), $pipes, null, $env, array('suppress_errors' => true)); - } + $proc = proc_open($commandline, array( + 0 => array('pipe', 'r'), + 1 => array('pipe', 'w'), + 2 => array('pipe', 'w') + ), $pipes, null, $env, array('suppress_errors' => true)); if (!$proc) { return false; @@ -231,12 +220,7 @@ class PEAR_RunTest function _preparePhpBin($php, $file, $ini_settings) { $file = escapeshellarg($file); - // This was fixed in php 5.3 and is not needed after that - if (OS_WINDOWS && version_compare(PHP_VERSION, '5.3', '<')) { - $cmd = '"'.escapeshellarg($php).' '.$ini_settings.' -f ' . $file .'"'; - } else { - $cmd = $php . $ini_settings . ' -f ' . $file; - } + $cmd = $php . $ini_settings . ' -f ' . $file; return $cmd; } @@ -275,10 +259,8 @@ class PEAR_RunTest */ function run($file, $ini_settings = array(), $test_number = 1) { - if (isset($this->_savephp)) { - $this->_php = $this->_savephp; - unset($this->_savephp); - } + $this->_restorePHPBinary(); + if (empty($this->_options['cgi'])) { // try to see if php-cgi is in the path $res = $this->system_with_timeout('php-cgi -v'); @@ -340,7 +322,7 @@ class PEAR_RunTest } return 'SKIPPED'; } - $this->_savephp = $this->_php; + $this->_savePHPBinary(); $this->_php = $this->_options['cgi']; } @@ -494,8 +476,6 @@ class PEAR_RunTest } chdir($cwd); // in case the test moves us around - $this->_testCleanup($section_text, $temp_clean); - /* when using CGI, strip the headers from the output */ $output = $this->_stripHeadersCGI($output); @@ -516,6 +496,9 @@ class PEAR_RunTest $output .= "\n====EXPECTHEADERS FAILURE====:\n$changed"; } } + + $this->_testCleanup($section_text, $temp_clean); + // Does the output match what is expected? do { if (isset($section_text['EXPECTF']) || isset($section_text['EXPECTREGEX'])) { @@ -639,6 +622,11 @@ class PEAR_RunTest $expectf = isset($section_text['EXPECTF']) ? $wanted_re : null; $data = $this->generate_diff($wanted, $output, $returns, $expectf); $res = $this->_writeLog($diff_filename, $data); + if (isset($this->_options['showdiff'])) { + $this->_logger->log(0, "========DIFF========"); + $this->_logger->log(0, $data); + $this->_logger->log(0, "========DONE========"); + } if (PEAR::isError($res)) { return $res; } @@ -954,6 +942,8 @@ $text function _testCleanup($section_text, $temp_clean) { if ($section_text['CLEAN']) { + $this->_restorePHPBinary(); + // perform test cleanup $this->save_text($temp_clean, $section_text['CLEAN']); $output = $this->system_with_timeout("$this->_php $temp_clean 2>&1"); @@ -965,4 +955,18 @@ $text } } } + + function _savePHPBinary() + { + $this->_savephp = $this->_php; + } + + function _restorePHPBinary() + { + if (isset($this->_savephp)) + { + $this->_php = $this->_savephp; + unset($this->_savephp); + } + } }