00001 <?php 00008 class UTConfig extends foUnitTestBase 00009 { 00010 public function doTest() 00011 { 00012 $this->_testConfig(); 00013 $this->_testSiteConfig(); 00014 $this->_testDbConfig(); 00015 } 00016 00017 private function _testConfig() 00018 { 00019 $config = new Config(); 00020 $this->setSectionLabel('Config'); 00021 eval($this->needNotEmpty('$config->getEnvironmentDir()')); 00022 00023 eval($this->needEmpty('$config->setEnvironmentDir("/var/www/fareofficeroot")')); 00024 eval($this->needEqual('$config->getEnvironmentDir()', '"/var/www/fareofficeroot/"')); 00025 00026 eval($this->needEqual('$config->getLogDir()', '"/var/www/fareofficeroot/Log/"')); 00027 eval($this->needEqual('$config->getSiteDir()', '"/var/www/fareofficeroot/Site/"')); 00028 00029 eval($this->needNotEmpty('$config->getSites()')); 00030 00031 foreach($config->getSites() as $siteConfig) 00032 { 00033 eval($this->needEqual('get_class($siteConfig)', '"SiteConfig"')); 00034 } 00035 } 00036 00037 private function _testSiteConfig() 00038 { 00039 $config = new Config(); 00040 $this->setSectionLabel('SiteConfig'); 00041 eval($this->needNotEmpty('$dbConfig = $config->getDbConfig()')); 00042 eval($this->needEmpty('$dbConfig->getDSN("mysql_database")')); 00043 00044 eval($this->needEmpty('$dbConfig->clearDSN()')); 00045 00046 eval($this->needEmpty('$dbConfig->setDSN("mysql_database", "mysql", "localhost", "root", "", "mysql")')); 00047 eval($this->needEqual('$dbConfig->getDSN("mysql_database")', 'array(\'phptype\'=>\'mysql\',\'hostspec\'=>\'localhost\',\'username\'=>\'root\',\'password\'=>\'\',\'database\'=>\'mysql\')')); 00048 00049 eval($this->needEqual('$config->getDBDSN("mysql_database")', 'array(\'phptype\'=>\'mysql\',\'hostspec\'=>\'localhost\',\'username\'=>\'root\',\'password\'=>\'\',\'database\'=>\'mysql\')')); 00050 } 00051 00052 private function _testDbConfig() 00053 { 00054 $config = new Config(); 00055 $this->setSectionLabel('DbConfig'); 00056 eval($this->needNotEmpty('$config->getSite("fareofficelib")')); 00057 00058 eval($this->needEqual('$config->getSite("fareofficelib")->getLogDir()', '"/var/www/fareofficeroot/Site/fareofficelib/Temp/Log/"')); 00059 eval($this->needEqual('$config->getSite("fareofficelib")->getCacheDir()', '"/var/www/fareofficeroot/Site/fareofficelib/Temp/Cache/"')); 00060 00061 } 00062 } 00063 ?>