com phpruntests: moving the getting of user supplied variables to main run code to allow independent testing of env settings:
src/configuration/rtEnvironmentVariables.php src/configuration/rtRuntestsConfiguration.php src/testrun/rtPhpTestRun.php

From: Date: Sun, 17 May 2009 13:58:51 +0000
Subject: com phpruntests: moving the getting of user supplied variables to main run code to allow independent testing of env settings:
src/configuration/rtEnvironmentVariables.php src/configuration/rtRuntestsConfiguration.php src/testrun/rtPhpTestRun.php
Groups: php.qa 
Request: Send a blank email to php-qa+get-66449@lists.php.net to get a copy of this message
Commit: 01b5bf3cbfc057e07af74fbf08245c6cdf2327be Author: Zoe Slattery <zoe@php.net> Sun, 17 May 2009 13:58:51 +0000 Parents: edc7cc71f610f3336bbfc92ff79881fb5dfedfc3 Branches: master Link: http://git.php.net/?p=phpruntests.git;a=commitdiff;h=01b5bf3cbfc057e07af74fbf08245c6cdf2327be Log: moving the getting of user supplied variables to main run code to allow independent testing of env settings Changed paths: M src/configuration/rtEnvironmentVariables.php M src/configuration/rtRuntestsConfiguration.php M src/testrun/rtPhpTestRun.php Diff: diff --git a/src/configuration/rtEnvironmentVariables.php b/src/configuration/rtEnvironmentVariables.php index eec63bd..e7f7821 100644 --- a/src/configuration/rtEnvironmentVariables.php +++ b/src/configuration/rtEnvironmentVariables.php @@ -22,7 +22,7 @@ class rtEnvironmentVariables 'NO_PHPTEST_SUMMARY', ); - private $environmentVariables; + private $environmentVariables = array(); public function __construct() { @@ -41,9 +41,7 @@ class rtEnvironmentVariables { if (isset($_ENV)) { $this->environmentVariables = $_ENV; - } else { - $this->environmentVariables = array(); - } + } foreach ($this->userSuppliedVariables as $variable) { if (getenv($variable)) { diff --git a/src/configuration/rtRuntestsConfiguration.php b/src/configuration/rtRuntestsConfiguration.php index c908dfe..24357f8 100644 --- a/src/configuration/rtRuntestsConfiguration.php +++ b/src/configuration/rtRuntestsConfiguration.php @@ -66,9 +66,8 @@ abstract class rtRuntestsConfiguration $this->commandLine = new rtCommandLineOptions; $this->commandLine->parse($this->commandLineArgs); - //get and put envrionment variables - $this->environmentVariables = rtEnvironmentVariables::getInstance(); - $this->environmentVariables->getUserSuppliedVariables(); + //create object to hold environment variables + $this->environmentVariables = rtEnvironmentVariables::getInstance(); } /** @@ -152,5 +151,9 @@ abstract class rtRuntestsConfiguration { return $this->commandLine->getTestFilename(); } + + public function getUserEnvironment() { + $this->environmentVariables->getUserSuppliedVariables(); + } } ?> diff --git a/src/testrun/rtPhpTestRun.php b/src/testrun/rtPhpTestRun.php index 830c58c..fc2b756 100644 --- a/src/testrun/rtPhpTestRun.php +++ b/src/testrun/rtPhpTestRun.php @@ -18,6 +18,7 @@ class rtPhpTestRun //Configure the test environment $runConfiguration = rtRuntestsConfiguration::getInstance($this->commandLineArguments); + $runConfiguration->getUserEnvironment(); $runConfiguration->configure(); //Check the preconditions

« previous php.qa (#66449) next »