com phpruntests: Changes to the wy that the CGI executable is set: src/configuration/rtRuntestsConfiguration.php
src/configuration/settings/rtCurrentDirectorySetting.php src/configuration/settings/rtPhpCgiExecutableSetting.php
src/configuration/settings/rtPhpExecutableSetting.php tests/configuration/settings/rtCurrentDirectorySettingTest.php
tests/configuration/settings/rtPhpCgiExecutableSettingTest.php tests/configuration/settings/rtPhpExecutabl
| From: | David Soria Parra | Date: | Sun, 26 Apr 2009 06:54:34 +0000 |
| Subject: | com phpruntests: Changes to the wy that the CGI executable is set: src/configuration/rtRuntestsConfiguration.php src/configuration/settings/rtCurrentDirectorySetting.php src/configuration/settings/rtPhpCgiExecutableSetting.php src/configuration/settings/rtPhpExecutableSetting.php tests/configuration/settings/rtCurrentDirectorySettingTest.php tests/configuration/settings/rtPhpCgiExecutableSettingTest.php tests/configuration/settings/rtPhpExecutabl |
||
| Groups: | php.qa | ||
| Request: | Send a blank email to php-qa+get-66520@lists.php.net to get a copy of this message | ||
Commit: 764fd77a5e2adb0f4b8bfd76c9654bc073e35683
Author: Zoe Slattery <zoe@php.net> Sun, 26 Apr 2009 06:54:34 +0000
Parents: 5b09fa145a76344b61849fbe15e57e94c33231e2
Branches: master
Link: http://git.php.net/?p=phpruntests.git;a=commitdiff;h=764fd77a5e2adb0f4b8bfd76c9654bc073e35683
Log:
Changes to the wy that the CGI executable is set
Changed paths:
M src/configuration/rtRuntestsConfiguration.php
M src/configuration/settings/rtCurrentDirectorySetting.php
M src/configuration/settings/rtPhpCgiExecutableSetting.php
M src/configuration/settings/rtPhpExecutableSetting.php
M tests/configuration/settings/rtCurrentDirectorySettingTest.php
M tests/configuration/settings/rtPhpCgiExecutableSettingTest.php
M tests/configuration/settings/rtPhpExecutableSettingTest.php
diff --git a/src/configuration/rtRuntestsConfiguration.php b/src/configuration/rtRuntestsConfiguration.php index 036ecdb..9aee170 100644 --- a/src/configuration/rtRuntestsConfiguration.php +++ b/src/configuration/rtRuntestsConfiguration.php @@ -1,9 +1,30 @@ <?php /** - * Contains onfiguration for test run. Includes: - * Command line option, environment variables, ini overrides and settings which are - * derived from one or more command line options or environment variables. + * rtRuntestsConfiguration * + * @category Testing + * @package RUNTESTS + * @author Zoe Slattery <zoe@php.net> + * @author Stefan Priebsch <spriebsch@php.net> + * @copyright 2009 The PHP Group + * @license http://www.php.net/license/3_01.txt PHP License 3.01 + * @link http://qa.php.net/ + */ + +/** + * Sets up the configuration for the whole test run + * + * Settings are derived from command line options and/or environment variables. + * Runtests also overrides a number of ini settings. + * + * + * @category Testing + * @package RUNTESTS + * @author Zoe Slattery <zoe@php.net> + * @author Stefan Priebsch <spriebsch@php.net> + * @copyright 2009 The PHP Group + * @license http://www.php.net/license/3_01.txt PHP License 3.01 + * @link http://qa.php.net/ */ abstract class rtRuntestsConfiguration { @@ -16,12 +37,12 @@ abstract class rtRuntestsConfiguration private $settingNames = array ( 'CurrentDirectory' => 'rtCurrentDirectorySetting', + 'WorkingDirectory' => 'rtWorkingDirectorySetting', 'LogFormat' => 'rtLogFormatSetting', 'PhpExecutable' => 'rtPhpExecutableSetting', 'PhpCgiExecutable' => 'rtPhpCgiExecutableSetting', 'TestFiles' => 'rtTestFileSetting', 'TestDirectories' => 'rtTestDirectorySetting', - 'WorkingDirectory' => 'rtWorkingDirectorySetting', 'PhpCommandLineArguments' => 'rtPhpCommandLineArgSetting', ); @@ -50,12 +71,10 @@ abstract class rtRuntestsConfiguration //set configuration foreach ($this->settingNames as $name => $setting) { $this->setters[$name] = new $setting($this); - } - - foreach ($this->settingNames as $name => $setting) { $methodName = 'set' . $name; $this->$methodName(); } + } /** @@ -76,7 +95,7 @@ abstract class rtRuntestsConfiguration * Sets the directory that run-tests was started from * */ - private function setCurrentDirectory() + private function setCurrentDirectory() { $this->settings['CurrentDirectory']= $this->setters['CurrentDirectory']->get(); } @@ -104,12 +123,12 @@ abstract class rtRuntestsConfiguration * */ private function setPhpCgiExecutable() - { - //If the CGI executable hasn't been set using an environmental variable or 'auto', try and derive it from + { + //If the CGI executable hasn't been set using an environmental variable or 'auto', try and derive it from //the name of the cli executable. //TODO This is *ix specific, need a WIN specific class PhpCgiExecutable setting class if($this->setters['PhpCgiExecutable']->get() == null) { - $this->setters['PhpCgiExecutable']->setFromPhpCli($this->settings['PhpExecutable']); + $this->setters['PhpCgiExecutable']->setFromPhpCli($this->settings['PhpExecutable']); } $this->settings['PhpCgiExecutable']= $this->setters['PhpCgiExecutable']->get(); } @@ -177,7 +196,7 @@ abstract class rtRuntestsConfiguration { return $this->environmentVariables->getVariable($name); } - + public function getEnvironmentVariables() { return $this->environmentVariables->getVariables(); @@ -192,7 +211,7 @@ abstract class rtRuntestsConfiguration { return $this->commandLine->getOption($option); } - + public function hasEnvironmentVariable($name) { return $this->environmentVariables->hasVariable($name); @@ -209,7 +228,7 @@ abstract class rtRuntestsConfiguration { $this->environmentVariables->setVariable($name, $value); } - + public function getTestFilename() { return $this->commandLine->getTestFilename(); diff --git a/src/configuration/settings/rtCurrentDirectorySetting.php b/src/configuration/settings/rtCurrentDirectorySetting.php index ec3f92e..e007a3f 100644 --- a/src/configuration/settings/rtCurrentDirectorySetting.php +++ b/src/configuration/settings/rtCurrentDirectorySetting.php @@ -14,7 +14,7 @@ class rtCurrentDirectorySetting extends rtSetting */ public function init(rtRuntestsConfiguration $configuration) { - $this->currentDirectory = getcwd(); + $this->currentDirectory = realpath(getcwd()); } /** diff --git a/src/configuration/settings/rtPhpCgiExecutableSetting.php b/src/configuration/settings/rtPhpCgiExecutableSetting.php index 30ac22c..3e31ee0 100644 --- a/src/configuration/settings/rtPhpCgiExecutableSetting.php +++ b/src/configuration/settings/rtPhpCgiExecutableSetting.php @@ -16,15 +16,11 @@ class rtPhpCgiExecutableSetting extends rtSetting */ public function init(rtRuntestsConfiguration $configuration) { - if (is_null($configuration->getSetting('workingDirectory'))) { - $workingDir = 'WORKING_DIR'; - } else { - $workingDir = $configuration->getSetting('workingDirectory'); - } + if ($configuration->hasEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE')) { if ($configuration->getEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE') == 'auto') { - $this->phpCgiExecutable = $workingDir . self::SAPI_CGI; + $this->phpCgiExecutable = $configuration->getSetting('WorkingDirectory') . self::SAPI_CGI; } else { $this->phpCgiExecutable = $configuration->getEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE'); } diff --git a/src/configuration/settings/rtPhpExecutableSetting.php b/src/configuration/settings/rtPhpExecutableSetting.php index 08beed8..5c6329e 100644 --- a/src/configuration/settings/rtPhpExecutableSetting.php +++ b/src/configuration/settings/rtPhpExecutableSetting.php @@ -9,23 +9,18 @@ class rtPhpExecutableSetting extends rtSetting const SAPI_CLI = "/sapi/cli/php"; private $phpExecutable; - + /** * Sets the PHP executable, note the dependency on working directory * */ public function init(rtRuntestsConfiguration $configuration) { - if (is_null($configuration->getSetting('workingDirectory'))) { - $workingDir = 'WORKING_DIR'; - } else { - $workingDir = $configuration->getSetting('workingDirectory'); - } - + if ($configuration->hasEnvironmentVariable('TEST_PHP_EXECUTABLE')) { - if ($configuration->getEnvironmentVariable('TEST_PHP_EXECUTABLE') == 'auto') { - $this->phpExecutable = $workingDir.self::SAPI_CLI; + if ($configuration->getEnvironmentVariable('TEST_PHP_EXECUTABLE') == 'auto') { + $this->phpExecutable = $configuration->getSetting('WorkingDirectory').self::SAPI_CLI; } else { $this->phpExecutable = $configuration->getEnvironmentVariable('TEST_PHP_EXECUTABLE'); } @@ -43,7 +38,7 @@ class rtPhpExecutableSetting extends rtSetting public function get() { return $this->phpExecutable; - } + } } ?> diff --git a/tests/configuration/settings/rtCurrentDirectorySettingTest.php b/tests/configuration/settings/rtCurrentDirectorySettingTest.php index 221320a..22ac996 100644 --- a/tests/configuration/settings/rtCurrentDirectorySettingTest.php +++ b/tests/configuration/settings/rtCurrentDirectorySettingTest.php @@ -10,7 +10,7 @@ class rtCurrentDirectorySettingTest extends PHPUnit_Framework_TestCase $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt')); $dirsetting = new rtCurrentDirectorySetting($configuration); - $this->assertEquals(getcwd(), $dirsetting->get()); + $this->assertEquals(realpath(getcwd()), $dirsetting->get()); } } ?> diff --git a/tests/configuration/settings/rtPhpCgiExecutableSettingTest.php b/tests/configuration/settings/rtPhpCgiExecutableSettingTest.php index 2c5e645..4483d03 100644 --- a/tests/configuration/settings/rtPhpCgiExecutableSettingTest.php +++ b/tests/configuration/settings/rtPhpCgiExecutableSettingTest.php @@ -8,34 +8,26 @@ class rtPhpCgiExecutableSettingTest extends PHPUnit_Framework_TestCase public function testSetPhpCgiExecutableEV() { $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', 'test.phpt')); $configuration->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE', 'a-php-executable'); - $cgisetting = new rtPhpCgiExecutableSetting($configuration); - $this->assertEquals('a-php-executable', $cgisetting->get()); } public function testSetPhpCgiExecutableEVAuto() { - $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', 'test.phpt')); + $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php','-p', 'a-php-exe', 'test.phpt')); $configuration->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE', 'auto'); - - $cgisetting = new rtPhpCgiExecutableSetting($configuration); - - $this->assertEquals('WORKING_DIR/sapi/cgi/php', $cgisetting->get()); + $configuration->configure(); + $this->assertEquals(realpath(getcwd()).'/sapi/cgi/php', $configuration->getSetting('PhpCgiExecutable')); } public function testSetPhpCgiExecutableNotSet() { $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', 'test.phpt')); - $cgisetting = new rtPhpCgiExecutableSetting($configuration); - $this->assertEquals(null, $cgisetting->get()); } - public function testSetFromCliExecutableName() { - + public function testSetFromCliExecutableName() { $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', '/a/sapi/cli/a-php-exe', 'test.phpt')); $config->configure(); - $this->assertEquals('/a/sapi/cgi/php', $config->getSetting('PhpCgiExecutable')); } } diff --git a/tests/configuration/settings/rtPhpExecutableSettingTest.php b/tests/configuration/settings/rtPhpExecutableSettingTest.php index 667f2d5..58a831a 100644 --- a/tests/configuration/settings/rtPhpExecutableSettingTest.php +++ b/tests/configuration/settings/rtPhpExecutableSettingTest.php @@ -24,14 +24,22 @@ class rtPhpExecutableSettingTest extends PHPUnit_Framework_TestCase $this->assertEquals('a-php-executable', $clisetting->get()); } - public function testSetPhpExecutableEVAuto() + public function testSetPhpExecutableEvAuto() { $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', 'test.phpt')); $configuration->setEnvironmentVariable('TEST_PHP_EXECUTABLE', 'auto'); + $configuration->setEnvironmentVariable('TEST_PHP_SRCDIR', '/some/directory'); + $configuration->configure(); + $this->assertEquals('/some/directory/sapi/cli/php', $configuration->getSetting('PhpExecutable')); + } - $clisetting = new rtPhpExecutableSetting($configuration); + public function testSetPhpExecutableCwdAuto() + { + $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', 'test.phpt')); + $configuration->setEnvironmentVariable('TEST_PHP_EXECUTABLE', 'auto'); + $configuration->configure(); - $this->assertEquals('WORKING_DIR/sapi/cli/php', $clisetting->get()); + $this->assertEquals(realpath(getcwd()).'/sapi/cli/php', $configuration->getSetting('PhpExecutable')); } } ?>
diff --git a/src/configuration/rtRuntestsConfiguration.php b/src/configuration/rtRuntestsConfiguration.php index 036ecdb..9aee170 100644 --- a/src/configuration/rtRuntestsConfiguration.php +++ b/src/configuration/rtRuntestsConfiguration.php @@ -1,9 +1,30 @@ <?php /** - * Contains onfiguration for test run. Includes: - * Command line option, environment variables, ini overrides and settings which are - * derived from one or more command line options or environment variables. + * rtRuntestsConfiguration * + * @category Testing + * @package RUNTESTS + * @author Zoe Slattery <zoe@php.net> + * @author Stefan Priebsch <spriebsch@php.net> + * @copyright 2009 The PHP Group + * @license http://www.php.net/license/3_01.txt PHP License 3.01 + * @link http://qa.php.net/ + */ + +/** + * Sets up the configuration for the whole test run + * + * Settings are derived from command line options and/or environment variables. + * Runtests also overrides a number of ini settings. + * + * + * @category Testing + * @package RUNTESTS + * @author Zoe Slattery <zoe@php.net> + * @author Stefan Priebsch <spriebsch@php.net> + * @copyright 2009 The PHP Group + * @license http://www.php.net/license/3_01.txt PHP License 3.01 + * @link http://qa.php.net/ */ abstract class rtRuntestsConfiguration { @@ -16,12 +37,12 @@ abstract class rtRuntestsConfiguration private $settingNames = array ( 'CurrentDirectory' => 'rtCurrentDirectorySetting', + 'WorkingDirectory' => 'rtWorkingDirectorySetting', 'LogFormat' => 'rtLogFormatSetting', 'PhpExecutable' => 'rtPhpExecutableSetting', 'PhpCgiExecutable' => 'rtPhpCgiExecutableSetting', 'TestFiles' => 'rtTestFileSetting', 'TestDirectories' => 'rtTestDirectorySetting', - 'WorkingDirectory' => 'rtWorkingDirectorySetting', 'PhpCommandLineArguments' => 'rtPhpCommandLineArgSetting', ); @@ -50,12 +71,10 @@ abstract class rtRuntestsConfiguration //set configuration foreach ($this->settingNames as $name => $setting) { $this->setters[$name] = new $setting($this); - } - - foreach ($this->settingNames as $name => $setting) { $methodName = 'set' . $name; $this->$methodName(); } + } /** @@ -76,7 +95,7 @@ abstract class rtRuntestsConfiguration * Sets the directory that run-tests was started from * */ - private function setCurrentDirectory() + private function setCurrentDirectory() { $this->settings['CurrentDirectory']= $this->setters['CurrentDirectory']->get(); } @@ -104,12 +123,12 @@ abstract class rtRuntestsConfiguration * */ private function setPhpCgiExecutable() - { - //If the CGI executable hasn't been set using an environmental variable or 'auto', try and derive it from + { + //If the CGI executable hasn't been set using an environmental variable or 'auto', try and derive it from //the name of the cli executable. //TODO This is *ix specific, need a WIN specific class PhpCgiExecutable setting class if($this->setters['PhpCgiExecutable']->get() == null) { - $this->setters['PhpCgiExecutable']->setFromPhpCli($this->settings['PhpExecutable']); + $this->setters['PhpCgiExecutable']->setFromPhpCli($this->settings['PhpExecutable']); } $this->settings['PhpCgiExecutable']= $this->setters['PhpCgiExecutable']->get(); } @@ -177,7 +196,7 @@ abstract class rtRuntestsConfiguration { return $this->environmentVariables->getVariable($name); } - + public function getEnvironmentVariables() { return $this->environmentVariables->getVariables(); @@ -192,7 +211,7 @@ abstract class rtRuntestsConfiguration { return $this->commandLine->getOption($option); } - + public function hasEnvironmentVariable($name) { return $this->environmentVariables->hasVariable($name); @@ -209,7 +228,7 @@ abstract class rtRuntestsConfiguration { $this->environmentVariables->setVariable($name, $value); } - + public function getTestFilename() { return $this->commandLine->getTestFilename(); diff --git a/src/configuration/settings/rtCurrentDirectorySetting.php b/src/configuration/settings/rtCurrentDirectorySetting.php index ec3f92e..e007a3f 100644 --- a/src/configuration/settings/rtCurrentDirectorySetting.php +++ b/src/configuration/settings/rtCurrentDirectorySetting.php @@ -14,7 +14,7 @@ class rtCurrentDirectorySetting extends rtSetting */ public function init(rtRuntestsConfiguration $configuration) { - $this->currentDirectory = getcwd(); + $this->currentDirectory = realpath(getcwd()); } /** diff --git a/src/configuration/settings/rtPhpCgiExecutableSetting.php b/src/configuration/settings/rtPhpCgiExecutableSetting.php index 30ac22c..3e31ee0 100644 --- a/src/configuration/settings/rtPhpCgiExecutableSetting.php +++ b/src/configuration/settings/rtPhpCgiExecutableSetting.php @@ -16,15 +16,11 @@ class rtPhpCgiExecutableSetting extends rtSetting */ public function init(rtRuntestsConfiguration $configuration) { - if (is_null($configuration->getSetting('workingDirectory'))) { - $workingDir = 'WORKING_DIR'; - } else { - $workingDir = $configuration->getSetting('workingDirectory'); - } + if ($configuration->hasEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE')) { if ($configuration->getEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE') == 'auto') { - $this->phpCgiExecutable = $workingDir . self::SAPI_CGI; + $this->phpCgiExecutable = $configuration->getSetting('WorkingDirectory') . self::SAPI_CGI; } else { $this->phpCgiExecutable = $configuration->getEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE'); } diff --git a/src/configuration/settings/rtPhpExecutableSetting.php b/src/configuration/settings/rtPhpExecutableSetting.php index 08beed8..5c6329e 100644 --- a/src/configuration/settings/rtPhpExecutableSetting.php +++ b/src/configuration/settings/rtPhpExecutableSetting.php @@ -9,23 +9,18 @@ class rtPhpExecutableSetting extends rtSetting const SAPI_CLI = "/sapi/cli/php"; private $phpExecutable; - + /** * Sets the PHP executable, note the dependency on working directory * */ public function init(rtRuntestsConfiguration $configuration) { - if (is_null($configuration->getSetting('workingDirectory'))) { - $workingDir = 'WORKING_DIR'; - } else { - $workingDir = $configuration->getSetting('workingDirectory'); - } - + if ($configuration->hasEnvironmentVariable('TEST_PHP_EXECUTABLE')) { - if ($configuration->getEnvironmentVariable('TEST_PHP_EXECUTABLE') == 'auto') { - $this->phpExecutable = $workingDir.self::SAPI_CLI; + if ($configuration->getEnvironmentVariable('TEST_PHP_EXECUTABLE') == 'auto') { + $this->phpExecutable = $configuration->getSetting('WorkingDirectory').self::SAPI_CLI; } else { $this->phpExecutable = $configuration->getEnvironmentVariable('TEST_PHP_EXECUTABLE'); } @@ -43,7 +38,7 @@ class rtPhpExecutableSetting extends rtSetting public function get() { return $this->phpExecutable; - } + } } ?> diff --git a/tests/configuration/settings/rtCurrentDirectorySettingTest.php b/tests/configuration/settings/rtCurrentDirectorySettingTest.php index 221320a..22ac996 100644 --- a/tests/configuration/settings/rtCurrentDirectorySettingTest.php +++ b/tests/configuration/settings/rtCurrentDirectorySettingTest.php @@ -10,7 +10,7 @@ class rtCurrentDirectorySettingTest extends PHPUnit_Framework_TestCase $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt')); $dirsetting = new rtCurrentDirectorySetting($configuration); - $this->assertEquals(getcwd(), $dirsetting->get()); + $this->assertEquals(realpath(getcwd()), $dirsetting->get()); } } ?> diff --git a/tests/configuration/settings/rtPhpCgiExecutableSettingTest.php b/tests/configuration/settings/rtPhpCgiExecutableSettingTest.php index 2c5e645..4483d03 100644 --- a/tests/configuration/settings/rtPhpCgiExecutableSettingTest.php +++ b/tests/configuration/settings/rtPhpCgiExecutableSettingTest.php @@ -8,34 +8,26 @@ class rtPhpCgiExecutableSettingTest extends PHPUnit_Framework_TestCase public function testSetPhpCgiExecutableEV() { $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', 'test.phpt')); $configuration->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE', 'a-php-executable'); - $cgisetting = new rtPhpCgiExecutableSetting($configuration); - $this->assertEquals('a-php-executable', $cgisetting->get()); } public function testSetPhpCgiExecutableEVAuto() { - $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', 'test.phpt')); + $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php','-p', 'a-php-exe', 'test.phpt')); $configuration->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE', 'auto'); - - $cgisetting = new rtPhpCgiExecutableSetting($configuration); - - $this->assertEquals('WORKING_DIR/sapi/cgi/php', $cgisetting->get()); + $configuration->configure(); + $this->assertEquals(realpath(getcwd()).'/sapi/cgi/php', $configuration->getSetting('PhpCgiExecutable')); } public function testSetPhpCgiExecutableNotSet() { $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', 'test.phpt')); - $cgisetting = new rtPhpCgiExecutableSetting($configuration); - $this->assertEquals(null, $cgisetting->get()); } - public function testSetFromCliExecutableName() { - + public function testSetFromCliExecutableName() { $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', '/a/sapi/cli/a-php-exe', 'test.phpt')); $config->configure(); - $this->assertEquals('/a/sapi/cgi/php', $config->getSetting('PhpCgiExecutable')); } } diff --git a/tests/configuration/settings/rtPhpExecutableSettingTest.php b/tests/configuration/settings/rtPhpExecutableSettingTest.php index 667f2d5..58a831a 100644 --- a/tests/configuration/settings/rtPhpExecutableSettingTest.php +++ b/tests/configuration/settings/rtPhpExecutableSettingTest.php @@ -24,14 +24,22 @@ class rtPhpExecutableSettingTest extends PHPUnit_Framework_TestCase $this->assertEquals('a-php-executable', $clisetting->get()); } - public function testSetPhpExecutableEVAuto() + public function testSetPhpExecutableEvAuto() { $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', 'test.phpt')); $configuration->setEnvironmentVariable('TEST_PHP_EXECUTABLE', 'auto'); + $configuration->setEnvironmentVariable('TEST_PHP_SRCDIR', '/some/directory'); + $configuration->configure(); + $this->assertEquals('/some/directory/sapi/cli/php', $configuration->getSetting('PhpExecutable')); + } - $clisetting = new rtPhpExecutableSetting($configuration); + public function testSetPhpExecutableCwdAuto() + { + $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', 'test.phpt')); + $configuration->setEnvironmentVariable('TEST_PHP_EXECUTABLE', 'auto'); + $configuration->configure(); - $this->assertEquals('WORKING_DIR/sapi/cli/php', $clisetting->get()); + $this->assertEquals(realpath(getcwd()).'/sapi/cli/php', $configuration->getSetting('PhpExecutable')); } } ?>