zoe             Thu May 14 11:34:59 2009 UTC

  Modified files:              
    /phpruntests/src/testcase   rtPhpTest.php rtTestConfiguration.php 
    /phpruntests/src/testcase/sections/executablesections       
                                                                
rtFileSection.php 
    /phpruntests/src/configuration/settings     
                                                rtPhpCgiExecutableSetting.php 
  Log:
  fixing cgi check
  
http://cvs.php.net/viewvc.cgi/phpruntests/src/testcase/rtPhpTest.php?r1=1.4&r2=1.5&diff_format=u
Index: phpruntests/src/testcase/rtPhpTest.php
diff -u phpruntests/src/testcase/rtPhpTest.php:1.4 
phpruntests/src/testcase/rtPhpTest.php:1.5
--- phpruntests/src/testcase/rtPhpTest.php:1.4  Sun Apr 26 22:43:36 2009
+++ phpruntests/src/testcase/rtPhpTest.php      Thu May 14 11:34:59 2009
@@ -60,7 +60,7 @@
         //Identify the file and expect section types
         $this->fileSection = $this->setFileSection();
         $this->expectSection = $this->setExpectSection();
-        
+
         $this->fileSection->setExecutableFileName($this->getName());
     }
 
@@ -80,8 +80,11 @@
 
         if (!array_key_exists('skip', $this->status) && 
!array_key_exists('bork', $this->status)) {
             $this->status = array_merge($this->status, 
$this->fileSection->run($this, $runConfiguration));
-            $this->output = $this->fileSection->getOutput();
-            $this->compareOutput();
+            //The test can be skipped by file sections if the CGI executable 
is not available
+            if(!array_key_exists('skip', $this->status)) {
+                $this->output = $this->fileSection->getOutput();
+                $this->compareOutput();
+            }
              
 
             if (array_key_exists('CLEAN', $this->sections)) {
http://cvs.php.net/viewvc.cgi/phpruntests/src/testcase/rtTestConfiguration.php?r1=1.13&r2=1.14&diff_format=u
Index: phpruntests/src/testcase/rtTestConfiguration.php
diff -u phpruntests/src/testcase/rtTestConfiguration.php:1.13 
phpruntests/src/testcase/rtTestConfiguration.php:1.14
--- phpruntests/src/testcase/rtTestConfiguration.php:1.13       Mon May  4 
17:02:37 2009
+++ phpruntests/src/testcase/rtTestConfiguration.php    Thu May 14 11:34:59 2009
@@ -40,7 +40,7 @@
 
     private function init(rtRuntestsConfiguration $runConfiguration, 
$sections, $sectionHeadings, $fileSection)
     {
-        $this->isCgiTest($sectionHeadings);
+        $this->setCgiTest($sectionHeadings);
 
         $this->setEnvironmentVariables($runConfiguration, $sections, 
$fileSection);
         $this->setPhpCommandLineArguments($runConfiguration, $sections);
@@ -110,7 +110,11 @@
     private function setPhpExecutable($runConfiguration, $sectionHeadings)
     {
         if ($this->cgiTest) {
-            $this->phpExecutable =  
$runConfiguration->getSetting('PhpCgiExecutable'). " -C";
+            if($runConfiguration->getSetting('PhpCgiExecutable') != null) {
+                $this->phpExecutable =  
$runConfiguration->getSetting('PhpCgiExecutable'). " -C";
+            } else {
+                $this->phpExecutable = null;
+            }
         } else {
             $this->phpExecutable = 
$runConfiguration->getSetting('PhpExecutable');
         }
@@ -133,7 +137,7 @@
         }
     }
 
-    private function isCgiTest($sectionHeadings)
+    private function setCgiTest($sectionHeadings)
     {
         $tempArray = array_diff($this->cgiSections, $sectionHeadings);
         if (count($tempArray) < count($this->cgiSections)) {
@@ -166,5 +170,10 @@
     {
         return $this->inputFileString;
     }
+
+    public function isCgiTest()
+    {
+        return $this->cgiTest;;
+    }
 }
 ?>
http://cvs.php.net/viewvc.cgi/phpruntests/src/testcase/sections/executablesections/rtFileSection.php?r1=1.8&r2=1.9&diff_format=u
Index: phpruntests/src/testcase/sections/executablesections/rtFileSection.php
diff -u 
phpruntests/src/testcase/sections/executablesections/rtFileSection.php:1.8 
phpruntests/src/testcase/sections/executablesections/rtFileSection.php:1.9
--- phpruntests/src/testcase/sections/executablesections/rtFileSection.php:1.8  
Tue Apr 28 20:58:39 2009
+++ phpruntests/src/testcase/sections/executablesections/rtFileSection.php      
Thu May 14 11:34:59 2009
@@ -15,7 +15,8 @@
 class rtFileSection extends rtExecutableSection
 {
     private $twoBlankLines = '\r?\n\r?\n';
-    
+    private $headers;
+
     public function setExecutableFileName($testName)
     {
         $this->fileName = $testName.".php";
@@ -44,15 +45,16 @@
 
             try {
                 $this->output = $PhpRunner->runphp();
-                
-                //If it's a CGI test sort the headers out here
-                if(substr($phpExecutable, -2) == '-C') {
-                    
+
+                //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];
-                    }
-                     
+                    }                     
                 }
 
 
@@ -62,8 +64,17 @@
         } else {
             $this->status['skip'] = 'The CGI executable is unavailable';
         }
-
         return $this->status;
     }
+
+    /**
+     *
+     */
+    public function getHeaders()
+    {
+        return $this->headers;
+    }
+
+
 }
 ?>
http://cvs.php.net/viewvc.cgi/phpruntests/src/configuration/settings/rtPhpCgiExecutableSetting.php?r1=1.7&r2=1.8&diff_format=u
Index: phpruntests/src/configuration/settings/rtPhpCgiExecutableSetting.php
diff -u 
phpruntests/src/configuration/settings/rtPhpCgiExecutableSetting.php:1.7 
phpruntests/src/configuration/settings/rtPhpCgiExecutableSetting.php:1.8
--- phpruntests/src/configuration/settings/rtPhpCgiExecutableSetting.php:1.7    
Tue May 12 09:15:19 2009
+++ phpruntests/src/configuration/settings/rtPhpCgiExecutableSetting.php        
Thu May 14 11:34:59 2009
@@ -33,10 +33,12 @@
     
     /**
      * @todo spriebsch: does this method need to be public, is it only called 
from get()?
+     * @todo zoe:This method only works if we are running from a PHP source 
tree, do we need to 
+     * cope with /usr/local/bin/php for example?
      */
     public function guessFromPhpCli($phpCli)
     {
-        if(substr(dirname($phpCli),-3) == 'cli') {
+        if(substr(dirname($phpCli),-3) == 'cli') {           
             $pathLength = strlen(dirname($phpCli)) - 3;
             $sapiDir = substr(dirname($phpCli), 0, $pathLength);          
             $this->phpCgiExecutable = $sapiDir."cgi/php-cgi";
@@ -57,7 +59,7 @@
             $rtPhpExecutableSetting = new 
rtPhpExecutableSetting($this->configuration);
             $this->guessFromPhpCli($rtPhpExecutableSetting->get());
         }
-    
+        
         return $this->phpCgiExecutable;
     }  
 }



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to