public function testLoadConfig() { $config = $this->config->get(); $this->assertArrayHasKey('url', $config); $this->assertArrayHasKey('locale', $config); $this->assertArrayHasKey('os', $config); $this->assertArrayHasKey('child', $config); $this->assertTrue(is_array($config['child'])); }
public function testFileConfigOverlaysConfigFilesInOrderTheyAreLoaded() { $one = $this->_createConfig(array('red' => 'green', 'blue' => 'yellow')); $two = $this->_createConfig(array('red' => 'red')); $config = new FileConfig(); $config->loadFile($one); $config->loadFile($two); $this->assertEquals($config->get('red'), 'red'); $this->assertEquals($config->get('blue'), 'yellow'); }
if (!function_exists("gettext")) { function gettext($str) { return $str; } } /** * Include the needed files */ require_once dirname(__FILE__) . '/lib/cli/Cli.php'; require_once dirname(__FILE__) . '/lib/config/FileConfig.php'; require_once dirname(__FILE__) . '/src/Generator.php'; // Try to read the config file if any try { $config = new FileConfig(dirname(__FILE__) . '/conf/settings.conf'); $locale = $config->get('language'); $domain = 'messages'; $lcDir = 'LC_MESSAGES'; $path = 'conf/translations'; $loc = substr($locale, 0, 5); $file = $path . '/' . $loc . '/' . $lcDir . '/' . $domain . '.mo'; if (file_exists($file) == false) { throw new Exception('The selected language file (' . $file . ') does not exist!'); } bindtextdomain($domain, $path); textdomain($domain); setlocale(LC_ALL, $locale); } catch (Exception $e) { // This should be the no file exception, then use the default settings } // Start
/** * */ public function testGet() { $this->assertEquals('bar', $this->object->get('foo')); $this->setExpectedException('Exception'); $this->object->get('woho'); }