diff options
author | Stig Bakken <ssb@php.net> | 2002-03-05 00:41:36 +0000 |
---|---|---|
committer | Stig Bakken <ssb@php.net> | 2002-03-05 00:41:36 +0000 |
commit | 2b9f5355890fb62b6c9558baba88c55ad8ae67c0 (patch) | |
tree | e9d4cd27c5df5d59dc90d5b7a2d83ba239a74aee /pear/tests | |
parent | 5f4fe6255e4703fe1d6347eee3a73dcc955d20c9 (diff) | |
download | php-git-2b9f5355890fb62b6c9558baba88c55ad8ae67c0.tar.gz |
* fixed a couple of bugs in PEAR_Config revealed by test
Diffstat (limited to 'pear/tests')
-rw-r--r-- | pear/tests/pear_config.phpt | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/pear/tests/pear_config.phpt b/pear/tests/pear_config.phpt index 89e760a380..726858a77e 100644 --- a/pear/tests/pear_config.phpt +++ b/pear/tests/pear_config.phpt @@ -4,9 +4,8 @@ PEAR_Config <?php error_reporting(E_ALL); -system("pwd"); chdir(dirname(__FILE__)); -include dirname(__FILE__)."/../PEAR/Config.php"; +include "../PEAR/Config.php"; copy("system.input", "system.conf"); copy("user.input", "user.conf"); PEAR::setErrorHandling(PEAR_ERROR_DIE, "%s\n"); @@ -15,15 +14,15 @@ dumpall(); print "creating config object\n"; $config = new PEAR_Config("user.conf", "system.conf"); -// overriding system values +print "overriding system values\n"; $config->set("master_server", "pear.localdomain"); -$config->writeConfigFile(); +$config->writeConfigFile(null, "user"); dumpall(); var_dump($config->get("master_server")); -// going back to defaults -$config->toDefault("master_server"); -$config->writeConfigFile(); +print "going back to defaults\n"; +$config->remove("master_server", "user"); +$config->writeConfigFile(null, "user"); dumpall(); // @@ -37,11 +36,9 @@ unlink("system.conf"); function dumpit($file) { - $fp = fopen($file, "r"); print "$file:"; - $data = unserialize(fread($fp, filesize($file))); - fclose($fp); - if (!is_array($data)) { + $data = PEAR_Config::_readConfigDataFrom($file); + if (empty($data)) { print " <empty>\n"; return; } @@ -64,11 +61,13 @@ dumping... system.conf: master_server="pear.php.net" user.conf: <empty> creating config object +overriding system values dumping... system.conf: master_server="pear.php.net" user.conf: master_server="pear.localdomain" string(16) "pear.localdomain" +going back to defaults dumping... system.conf: master_server="pear.php.net" -user.conf: +user.conf: <empty> done |