cvs: phpruntests /src/testcase/sections/configurationsections rtEnvSection.php /tests/testcase/sections/configurationsections rtEnvSectionTest.php
| From: | Zoe Slattery | Date: | Mon, 18 May 2009 20:06:11 +0000 |
| Subject: | cvs: phpruntests /src/testcase/sections/configurationsections rtEnvSection.php /tests/testcase/sections/configurationsections rtEnvSectionTest.php | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-57969@lists.php.net to get a copy of this message | ||
zoe Mon May 18 20:06:11 2009 UTC
Modified files:
/phpruntests/tests/testcase/sections/configurationsections
rtEnvSectionTest.php
/phpruntests/src/testcase/sections/configurationsections
rtEnvSection.php
Log:
fixed problem with additional = signs in ENV settings
http://cvs.php.net/viewvc.cgi/phpruntests/tests/testcase/sections/configurationsections/rtEnvSectionTest.php?r1=1.3&r2=1.4&diff_format=u
Index: phpruntests/tests/testcase/sections/configurationsections/rtEnvSectionTest.php
diff -u phpruntests/tests/testcase/sections/configurationsections/rtEnvSectionTest.php:1.3
phpruntests/tests/testcase/sections/configurationsections/rtEnvSectionTest.php:1.4
--- phpruntests/tests/testcase/sections/configurationsections/rtEnvSectionTest.php:1.3 Sun May 17
12:54:29 2009
+++ phpruntests/tests/testcase/sections/configurationsections/rtEnvSectionTest.php Mon May 18
20:06:10 2009
@@ -5,13 +5,22 @@
class rtEnvSectionTest extends PHPUnit_Framework_TestCase
{
- public function testCreateInstance()
+ public function testCreateInstance()
{
- $envSection = rtEnvSection::getInstance('ENV', array('env1 = ENV1',
'env2=ENV2'));
+ $envSection = rtEnvSection::getInstance('ENV', array('env1 = ENV1',
'env2=ENV2'));
$envlist = $envSection->getTestEnvironmentVariables();
$this->assertEquals('ENV1', $envlist['env1']);
$this->assertEquals('ENV2', $envlist['env2']);
}
+
+ public function testCreateInstance2()
+ {
+ $envSection = rtEnvSection::getInstance('ENV', array('env1 =
ENV1=env'));
+ $envlist = $envSection->getTestEnvironmentVariables();
+
+ $this->assertEquals('ENV1=env', $envlist['env1']);
+
+ }
}
?>
http://cvs.php.net/viewvc.cgi/phpruntests/src/testcase/sections/configurationsections/rtEnvSection.php?r1=1.2&r2=1.3&diff_format=u
Index: phpruntests/src/testcase/sections/configurationsections/rtEnvSection.php
diff -u phpruntests/src/testcase/sections/configurationsections/rtEnvSection.php:1.2
phpruntests/src/testcase/sections/configurationsections/rtEnvSection.php:1.3
--- phpruntests/src/testcase/sections/configurationsections/rtEnvSection.php:1.2 Fri Apr 24 08:41:26
2009
+++ phpruntests/src/testcase/sections/configurationsections/rtEnvSection.php Mon May 18 20:06:11
2009
@@ -9,8 +9,11 @@
protected function init()
{
foreach ($this->sectionContents as $line) {
- $tempArray = explode('=', $line);
- $this->testEnvironmentVariables[trim($tempArray[0])] = trim($tempArray[1]);
+ $firstEqualsPosition = strpos($line, "=");
+ $variableName = substr($line, 0, -(strlen($line) - $firstEqualsPosition));
+ $variableValue = substr($line, -(strlen($line) - $firstEqualsPosition - 1));
+
+ $this->testEnvironmentVariables[trim($variableName)] = trim($variableValue);
}
}