示例#1
0
文件: StartTest.php 项目: tdt/start
 public function testConfigClass()
 {
     // Regular config
     $config = array("general" => array("hostname" => "http://localhost.be", "subdir" => "", "cache" => array("system" => "MemCache", "port" => 50123)), "db" => array("host" => "localhost", "port" => 3366));
     Config::setConfig($config);
     $this->assertEquals($config, Config::getConfigArray(), "Config array doesn't match");
     $this->assertCount(3, Config::get('general'), "Number of items doesn't match");
     $this->assertEquals(3366, Config::get('db', 'port'), "First level value not matching");
     $this->assertEquals("MemCache", Config::get('general', 'cache', 'system'), "Second level value not matching");
     $this->assertEmpty(Config::get('general', 'cache', 'host'), "Non-existing key not returning empty value");
     // Empty array
     $config = array();
     Config::setConfig($config);
     $this->assertEquals($config, Config::getConfigArray(), "Config array doesn't match");
     $this->assertEmpty(Config::get('general'), "Previous config is still in the array");
 }
示例#2
0
 /**
  * PATCH is not supported on the user interface
  */
 public function PATCH($matches)
 {
     //get the current URL
     $ru = RequestURI::getInstance(Config::getConfigArray());
     $pageURL = $ru->getURI();
     $exception_config = array();
     $exception_config["log_dir"] = Config::get("general", "logging", "path");
     $exception_config["url"] = Config::get("general", "hostname") . Config::get("general", "subdir") . "error";
     throw new TDTException(450, array("PATCH", $pageURL), $exception_config);
 }