com phpruntests: moving CGI check: src/testcase/sections/executablesections/rtFileSection.php
| From: | David Soria Parra | Date: | Sun, 17 May 2009 12:30:59 +0000 |
| Subject: | com phpruntests: moving CGI check: src/testcase/sections/executablesections/rtFileSection.php | ||
| Groups: | php.qa | ||
| Request: | Send a blank email to php-qa+get-66452@lists.php.net to get a copy of this message | ||
Commit: ed7b65ce50d1dab92467224224c16329756c97b2
Author: Zoe Slattery <zoe@php.net> Sun, 17 May 2009 12:30:59 +0000
Parents: d134bb32ff9df2d34d6163d2d995921c6fba009b
Branches: master
Link: http://git.php.net/?p=phpruntests.git;a=commitdiff;h=ed7b65ce50d1dab92467224224c16329756c97b2
Log:
moving CGI check
Changed paths:
M src/testcase/sections/executablesections/rtFileSection.php
Diff:
diff --git a/src/testcase/sections/executablesections/rtFileSection.php
b/src/testcase/sections/executablesections/rtFileSection.php
index 839db0e..65d73a7 100644
--- a/src/testcase/sections/executablesections/rtFileSection.php
+++ b/src/testcase/sections/executablesections/rtFileSection.php
@@ -21,7 +21,7 @@ class rtFileSection extends rtExecutableSection
{
$this->fileName = $testName.".php";
}
-
+
protected function init() {
$contents = array();
foreach($this->sectionContents as $line) {
@@ -32,7 +32,7 @@ class rtFileSection extends rtExecutableSection
$this->sectionContents = $contents;
break;
}
- }
+ }
}
public function run(rtPhpTest $testCase, rtRuntestsConfiguration $runConfiguration)
@@ -43,50 +43,53 @@ class rtFileSection extends rtExecutableSection
$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;
+}
}