zoe             Fri May 15 06:48:07 2009 UTC

  Modified files:              
    /phpruntests/src/configuration/settings     
                                                rtPhpCgiExecutableSetting.php 
    /phpruntests/tests/configuration/settings   
                                                
rtPhpCgiExecutableSettingTest.php 
  Log:
  Fixing Georg's problem?
  
http://cvs.php.net/viewvc.cgi/phpruntests/src/configuration/settings/rtPhpCgiExecutableSetting.php?r1=1.8&r2=1.9&diff_format=u
Index: phpruntests/src/configuration/settings/rtPhpCgiExecutableSetting.php
diff -u 
phpruntests/src/configuration/settings/rtPhpCgiExecutableSetting.php:1.8 
phpruntests/src/configuration/settings/rtPhpCgiExecutableSetting.php:1.9
--- phpruntests/src/configuration/settings/rtPhpCgiExecutableSetting.php:1.8    
Thu May 14 11:34:59 2009
+++ phpruntests/src/configuration/settings/rtPhpCgiExecutableSetting.php        
Fri May 15 06:48:07 2009
@@ -9,9 +9,9 @@
     const SAPI_CGI = "/sapi/cgi/php-cgi";
 
     private $phpCgiExecutable;
-    
+
     private $configuration;
-    
+
     /**
      * Sets the PHP CGI executable. Note the dependency on having a working 
directory setting
      *
@@ -19,28 +19,30 @@
     public function init(rtRuntestsConfiguration $configuration)
     {
         $this->configuration = $configuration;
-        
+
         if ($configuration->hasEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE')) 
{
-            if 
($configuration->getEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE') == 'auto') {
+            
if($configuration->getEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE') != null) {
+                if 
($configuration->getEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE') == 'auto') {
 
-                $rtWorkingDirectorySetting = new 
rtWorkingDirectorySetting($configuration);
-                $this->phpCgiExecutable = $rtWorkingDirectorySetting->get() . 
self::SAPI_CGI;
-            } else {
-                $this->phpCgiExecutable = 
$configuration->getEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE');
+                    $rtWorkingDirectorySetting = new 
rtWorkingDirectorySetting($configuration);
+                    $this->phpCgiExecutable = 
$rtWorkingDirectorySetting->get() . self::SAPI_CGI;
+                } else {
+                    $this->phpCgiExecutable = 
$configuration->getEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE');
+                }
             }
-        } 
+        }
     }
-    
+
     /**
      * @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 
+     * @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);          
+            $sapiDir = substr(dirname($phpCli), 0, $pathLength);
             $this->phpCgiExecutable = $sapiDir."cgi/php-cgi";
         }
     }
@@ -51,7 +53,7 @@
      *
      * @return string
      */
-    public function get() 
+    public function get()
     {
         if (is_null($this->phpCgiExecutable)) {
 
@@ -59,8 +61,8 @@
             $rtPhpExecutableSetting = new 
rtPhpExecutableSetting($this->configuration);
             $this->guessFromPhpCli($rtPhpExecutableSetting->get());
         }
-        
+
         return $this->phpCgiExecutable;
-    }  
+    }
 }
 ?>
http://cvs.php.net/viewvc.cgi/phpruntests/tests/configuration/settings/rtPhpCgiExecutableSettingTest.php?r1=1.5&r2=1.6&diff_format=u
Index: 
phpruntests/tests/configuration/settings/rtPhpCgiExecutableSettingTest.php
diff -u 
phpruntests/tests/configuration/settings/rtPhpCgiExecutableSettingTest.php:1.5 
phpruntests/tests/configuration/settings/rtPhpCgiExecutableSettingTest.php:1.6
--- 
phpruntests/tests/configuration/settings/rtPhpCgiExecutableSettingTest.php:1.5  
    Tue May 12 09:15:18 2009
+++ phpruntests/tests/configuration/settings/rtPhpCgiExecutableSettingTest.php  
Fri May 15 06:48:07 2009
@@ -23,13 +23,15 @@
 
     public function testSetPhpCgiExecutableNotSet() {
         $configuration = 
rtRuntestsConfiguration::getInstance(array('run-tests.php', 'test.phpt'));
+        $configuration->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE', '');
         $setting = new rtPhpCgiExecutableSetting($configuration);
         
         $this->assertEquals(null, $setting->get());
     }
 
     public function testSetFromCliExecutableName() {        
-        $configuration = 
rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 
'/a/sapi/cli/a-php-exe', 'test.phpt'));
+        $configuration = 
rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 
'/a/sapi/cli/php', 'test.phpt'));
+        $configuration->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE', 
null);
         $setting = new rtPhpCgiExecutableSetting($configuration);
 
         $this->assertEquals('/a/sapi/cgi/php-cgi', $setting->get());



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

Reply via email to