com phpruntests: another bug fix: src/configuration/rtIniAsCommandLineArgs.php tests/configuration/rtIniAsCommandLineArgsTest.php

From: Date: Sun, 14 Jun 2009 14:28:28 +0000
Subject: com phpruntests: another bug fix: src/configuration/rtIniAsCommandLineArgs.php tests/configuration/rtIniAsCommandLineArgsTest.php
Groups: php.qa 
Request: Send a blank email to php-qa+get-66411@lists.php.net to get a copy of this message
Commit: 8dbb9ad5aaef99b2503d972cb7c11975a05f67a1 Author: Zoe Slattery <zoe@php.net> Sun, 14 Jun 2009 14:28:28 +0000 Parents: 0e4d2895c7c628aa6b8722f3a08ac6d207c1efd9 Branches: master Link: http://git.php.net/?p=phpruntests.git;a=commitdiff;h=8dbb9ad5aaef99b2503d972cb7c11975a05f67a1 Log: another bug fix Changed paths: M src/configuration/rtIniAsCommandLineArgs.php M tests/configuration/rtIniAsCommandLineArgsTest.php Diff: diff --git a/src/configuration/rtIniAsCommandLineArgs.php b/src/configuration/rtIniAsCommandLineArgs.php index 3183257..a44737a 100644 --- a/src/configuration/rtIniAsCommandLineArgs.php +++ b/src/configuration/rtIniAsCommandLineArgs.php @@ -89,22 +89,11 @@ class rtIniAsCommandLineArgs if ($parts[0] === $string) { return false; } - - //test for ==, which is allowed - if (strncmp($parts[1], '=', 1) === 0) { - return true; - } - - //test for a=b=c - if (strstr($parts[1], '=') == false) { - return true; - } else { - return false; - } + return true; } /** - * Removes spaces from ini settings, "a = b" is retirned as "a=b" + * Removes spaces from ini settings, "a = b" is returned as "a=b" * * @param string - ini setting * @return string - ini setting with any spaces removed diff --git a/tests/configuration/rtIniAsCommandLineArgsTest.php b/tests/configuration/rtIniAsCommandLineArgsTest.php index 0bf987e..fa94840 100644 --- a/tests/configuration/rtIniAsCommandLineArgsTest.php +++ b/tests/configuration/rtIniAsCommandLineArgsTest.php @@ -54,24 +54,29 @@ class rtIniAsCommandLineArgsTest extends PHPUnit_Framework_TestCase $addStr = $iniSet->settingsToArguments(array('af'), $iniSet->getBasePhpDArgs()); } - /** - * @expectedException rtUnknownIniSettingException - */ - public function testInvalidArg2() + + public function testValidDoubleEquals() { $iniSet = new rtIniAsCommandLineArgs(); $iniSet->setBase(); - $addStr = $iniSet->settingsToArguments(array('af=be=blah'), $iniSet->getBasePhpDArgs()); + $addStr = $iniSet->settingsToArguments(array('af=='), $iniSet->getBasePhpDArgs()); + $last3= addslashes(substr($addStr, -3)); + + $this->assertEquals('==\"', $last3); } - public function testValidDoubleEquals() + public function testValidComplex() { $iniSet = new rtIniAsCommandLineArgs(); $iniSet->setBase(); - $addStr = $iniSet->settingsToArguments(array('af=='), $iniSet->getBasePhpDArgs()); + $addStr = $iniSet->settingsToArguments(array('pdo.dsn.mysql="mysql:dbname=phptest;socket=/tmp/mysql.sock" + '), $iniSet->getBasePhpDArgs()); + $last3= addslashes(substr($addStr, -3)); - $this->assertEquals('==\"', $last3); + $this->assertEquals('k\"\"', $last3); } + + } ?>

« previous php.qa (#66411) next »