cvs: phpruntests /src/testcase/sections/executablesections rtFileSection.php

From: Date: Sun, 17 May 2009 12:30:59 +0000
Subject: cvs: phpruntests /src/testcase/sections/executablesections rtFileSection.php
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-57911@lists.php.net to get a copy of this message
zoe Sun May 17 12:30:59 2009 UTC Modified files: /phpruntests/src/testcase/sections/executablesections rtFileSection.php Log: moving CGI check http://cvs.php.net/viewvc.cgi/phpruntests/src/testcase/sections/executablesections/rtFileSection.php?r1=1.10&r2=1.11&diff_format=u Index: phpruntests/src/testcase/sections/executablesections/rtFileSection.php diff -u phpruntests/src/testcase/sections/executablesections/rtFileSection.php:1.10 phpruntests/src/testcase/sections/executablesections/rtFileSection.php:1.11 --- phpruntests/src/testcase/sections/executablesections/rtFileSection.php:1.10 Thu May 14 19:56:30 2009 +++ phpruntests/src/testcase/sections/executablesections/rtFileSection.php Sun May 17 12:30:59 2009 @@ -21,7 +21,7 @@ { $this->fileName = $testName.".php"; } - + protected function init() { $contents = array(); foreach($this->sectionContents as $line) { @@ -32,7 +32,7 @@ $this->sectionContents = $contents; break; } - } + } } public function run(rtPhpTest $testCase, rtRuntestsConfiguration $runConfiguration) @@ -43,50 +43,53 @@ $phpExecutable = $testCase->testConfiguration->getPhpExecutable(); // The CGI excutable is null if it is not available, check and SKIP if necessary - if ($phpExecutable != null) { - $phpCommand = $phpExecutable; - $phpCommand .= ' '. $testCase->testConfiguration->getPhpCommandLineArguments(); - $phpCommand .= ' -f '.$this->fileName; - $phpCommand .= ' '.$testCase->testConfiguration->getTestCommandLineArguments(); - $phpCommand .= ' 2>&1 '.$testCase->testConfiguration->getInputFileString(); - - - $PhpRunner = new rtPhpRunner($phpCommand, - $testCase->testConfiguration->getEnvironmentVariables(), - $runConfiguration->getSetting('WorkingDirectory') - ); - - try { - $this->output = $PhpRunner->runphp(); - - //If it's a CGI test and separate the headers from the output - if($testCase->testConfiguration->isCgiTest()) { - // Would this be better done with substr/strpos, not sure how to cope with \n - // Do Web servers alsways send \n\r\n\r? I *think* so but need to check - - if (preg_match("/^(.*?)$this->twoBlankLines(.*)/s", $this->output, $match)) { - $this->output = $match[2]; - $this->headers = $match[1]; - } - } + if (is_null($phpExecutable)) { + $this->status['skip'] = 'The CGI executable is unavailable'; + return $this->status; + } - } catch (rtPhpRunnerException $e) { - $this->status['fail'] = $e->getMessage(); + $phpCommand = $phpExecutable; + $phpCommand .= ' '. $testCase->testConfiguration->getPhpCommandLineArguments(); + $phpCommand .= ' -f '.$this->fileName; + $phpCommand .= ' '.$testCase->testConfiguration->getTestCommandLineArguments(); + $phpCommand .= ' 2>&1 '.$testCase->testConfiguration->getInputFileString(); + + + $PhpRunner = new rtPhpRunner($phpCommand, + $testCase->testConfiguration->getEnvironmentVariables(), + $runConfiguration->getSetting('WorkingDirectory') + ); + + try { + $this->output = $PhpRunner->runphp(); + + //If it's a CGI test and separate the headers from the output + if($testCase->testConfiguration->isCgiTest()) { + // Would this be better done with substr/strpos, not sure how to cope with \n + // Do Web servers alsways send \n\r\n\r? I *think* so but need to check + + if (preg_match("/^(.*?)$this->twoBlankLines(.*)/s", $this->output, $match)) { + $this->output = $match[2]; + $this->headers = $match[1]; + } } - } else { - $this->status['skip'] = 'The CGI executable is unavailable'; + + + } catch (rtPhpRunnerException $e) { + $this->status['fail'] = $e->getMessage(); } - return $this->status; - } + + return $this->status; +} - /** - * - */ - public function getHeaders() - { - return $this->headers; - } +/** + * + */ +public function getHeaders() +{ + return $this->headers; +} }

« previous php.cvs (#57911) next »