public function testConfigValue() { // reset and cache to empty (default) values list($options, $arguments) = XRef::getCmdOptions(array()); // get config by value, save current settings $old_config_value = XRef::getConfig(); $config = XRef::getConfig(true); $this->assertTrue(is_array($config)); $this->assertTrue(!isset($config["foo.bar"])); $args = array("test.php", "-d", "foo.bar=true"); list($options, $arguments) = XRef::getCmdOptions($args); $config = XRef::getConfig(true); $this->assertTrue(is_array($config)); $this->assertTrue(isset($config["foo.bar"])); $this->assertTrue($config["foo.bar"]); $args = array("test.php", "-d", "f.b=true", "--define", "p=false", "-d", "x=y"); list($options, $arguments) = XRef::getCmdOptions($args); $config = XRef::getConfig(true); $this->assertTrue(is_array($config)); $this->assertTrue(!isset($config["foo.bar"])); $this->assertTrue(isset($config["f.b"])); $this->assertTrue(isset($config["p"])); $this->assertTrue(isset($config["x"])); $this->assertTrue($config["f.b"] === true); $this->assertTrue($config["p"] === false); $this->assertTrue($config["x"] === "y"); // reset command-line options, restore value of the config list($options, $arguments) = XRef::getCmdOptions(array()); $config_ref =& XRef::getConfig(); $config_ref = $old_config_value; }