zoe             Sat Apr 25 15:04:23 2009 UTC

  Modified files:              
    /phpruntests/src/testcase   rtPhpTest.php rtTestConfiguration.php 
  Log:
  Adding check for CGI executable
  
http://cvs.php.net/viewvc.cgi/phpruntests/src/testcase/rtPhpTest.php?r1=1.2&r2=1.3&diff_format=u
Index: phpruntests/src/testcase/rtPhpTest.php
diff -u phpruntests/src/testcase/rtPhpTest.php:1.2 
phpruntests/src/testcase/rtPhpTest.php:1.3
--- phpruntests/src/testcase/rtPhpTest.php:1.2  Fri Apr 24 08:41:26 2009
+++ phpruntests/src/testcase/rtPhpTest.php      Sat Apr 25 15:04:23 2009
@@ -1,7 +1,17 @@
 <?php
 /**
  *
+ * This class represents a single phpt test case.
+ *
+ * @category   Quality Assurance
+ * @package    run-tests
+ * @author     Zoe Slattery <z...@php.net>
+ * @author     Stefan Priebsch <sprieb...@php.net>
+ * @copyright  2009 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ *
  */
+
 class rtPhpTest
 {
     public $testConfiguration;
@@ -54,7 +64,7 @@
 
     public function init(rtRuntestsConfiguration $runConfiguration)
     {
-        $this->testConfiguration = new rtTestConfiguration($runConfiguration, 
$this->sections);
+        $this->testConfiguration = new rtTestConfiguration($runConfiguration, 
$this->sections, $this->sectionHeadings);
     }
 
     //run
http://cvs.php.net/viewvc.cgi/phpruntests/src/testcase/rtTestConfiguration.php?r1=1.2&r2=1.3&diff_format=u
Index: phpruntests/src/testcase/rtTestConfiguration.php
diff -u phpruntests/src/testcase/rtTestConfiguration.php:1.2 
phpruntests/src/testcase/rtTestConfiguration.php:1.3
--- phpruntests/src/testcase/rtTestConfiguration.php:1.2        Fri Apr 24 
08:41:26 2009
+++ phpruntests/src/testcase/rtTestConfiguration.php    Sat Apr 25 15:04:23 2009
@@ -1,36 +1,57 @@
 <?php
 /**
- * Needs to set up teh configuration fo rthe test. This comes from
- *     1. RuntestsConfiguration
- *  2. Sections which modify the Runtests configuration
+ *
+ * This class holds confiurtaion settings that are specific to a single test.
+ * Test sections which adjust the confiuration for single test include ARGS, 
ENV, INI
+ *
+ * @category   Quality Assurance
+ * @package    run-tests
+ * @author     Zoe Slattery <z...@php.net>
+ * @author     Stefan Priebsch <sprieb...@php.net>
+ * @copyright  2009 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ *
  */
+
+
 class rtTestConfiguration
 {
     private $environmentVariables;
     private $phpCommandLineArguments;
     private $testCommandLineArguments;
+    private $phpExecutable;
+    private $cgiSections = array(
+                            'GET',
+                            'POST',
+                            'POST_RAW',
+                            'GZIP_POST',
+                            'DEFLATE_POST',
+                            'EXPECTHEADERS',
+                            'COOKIE',
+    );
 
-    public function __construct(rtRuntestsConfiguration $runConfiguration, 
$sections)
+    public function __construct(rtRuntestsConfiguration $runConfiguration, 
$sections, $sectionHeadings)
     {
-        $this->init($runConfiguration, $sections);
+        $this->init($runConfiguration, $sections, $sectionHeadings);
     }
 
-    private function init(rtRuntestsConfiguration $runConfiguration, $sections)
+    private function init(rtRuntestsConfiguration $runConfiguration, 
$sections, $sectionHeadings)
     {
         $this->setEnvironmentVariables($runConfiguration, $sections);
         $this->setPhpCommandLineArguments($runConfiguration, $sections);
         $this->setTestCommandLineArguments($sections);
+        $this->setPhpExecutable($runConfiguration, $sectionHeadings);
     }
 
     private function setEnvironmentVariables(rtRuntestsConfiguration 
$runConfiguration, $sections)
     {
         $this->environmentVariables = 
$runConfiguration->getEnvironmentVariables();
-        if (array_key_exists('ENV', $sections)) {    
+        if (array_key_exists('ENV', $sections)) {
             $this->environmentVariables = 
array_merge($this->environmentVariables, 
$sections['ENV']->getTestEnvironmentVariables());
         }
     }
 
-    private function setPhpCommandLineArguments(rtRuntestsConfiguration 
$runConfiguration, $sections) 
+    private function setPhpCommandLineArguments(rtRuntestsConfiguration 
$runConfiguration, $sections)
     {
         $this->phpCommandLineArguments = 
$runConfiguration->getSetting('PhpCommandLineArguments');
         if (array_key_exists('INI', $sections)) {
@@ -49,6 +70,21 @@
         }
     }
 
+    private function setPhpExecutable($runConfiguration, $sectionHeadings)
+    {
+        $tempArray = array_diff($this->cgiSections, $sectionHeadings);
+        if (count($tempArray) < count($this->cgiSections)) {
+            $this->phpExecutable =  
$runConfiguration->getSetting('PhpCgiExecutable');
+        } else {
+            $this->phpExecutable = 
$runConfiguration->getSetting('PhpExecutable');
+        }
+    }
+
+    public function getPhpExecutable()
+    {
+        return $this->phpExecutable;
+    }
+
     public function getEnvironmentVariables()
     {
         return $this->environmentVariables;



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

Reply via email to