public function setupSettings($appDir) { if (!$this->setupSettings) { return; } $Setting = ClassRegistry::init('Settings.Setting'); $Setting->settingsPath = $appDir . 'Config' . DS . 'settings.json'; Configure::drop('settings'); Configure::config('settings', new CroogoJsonReader(dirname($Setting->settingsPath) . DS)); $Setting->writeConfiguration(); }
/** * setUp * * @return void */ public function setUp() { parent::setUp(); App::build(array('Plugin' => array(TESTS . 'test_app' . DS . 'Plugin' . DS), 'View' => array(TESTS . 'test_app' . DS . 'View' . DS)), App::PREPEND); CakePlugin::unload('Install'); CakePlugin::load('Example'); Configure::write('Acl.database', 'test'); $Setting = ClassRegistry::init('Settings.Setting'); $Setting->settingsPath = TESTS . 'test_app' . DS . 'Config' . DS . 'settings.json'; Configure::drop('settings'); Configure::config('settings', new CroogoJsonReader(dirname($Setting->settingsPath) . DS)); $Setting->writeConfiguration(); }
public function tearDown() { parent::tearDown(); foreach (Configure::configured() as $config) { if (strpos($config, 'I18nYamlTestConfig') !== false) { Configure::drop($config); } } I18n::clear(); App::build(); foreach (array_keys(Configure::read()) as $key) { Configure::delete($key); } Configure::write($this->_config); }
public function testRead() { $this->_configTestFile(); Configure::load('spyc', 'YamlTestConfig'); $expected = array(array('name' => 'spartan', 'notes' => array('Needs to be backed up', 'Needs to be normalized'), 'type' => 'mysql')); $this->assertIdentical(Configure::read('spyc.databases'), $expected); Configure::drop('YamlTestConfig'); Configure::delete('spyc'); $this->_configTestFile(array('path' => App::pluginPath('YamlReader') . 'Test' . DS . 'files' . DS)); Configure::load('spyc', 'YamlTestConfig'); $this->assertIdentical(Configure::read('spyc.databases'), $expected); $this->_configTestFile(null, false); Configure::load('spyc', 'YamlTestConfig'); $this->assertIdentical(Configure::read('databases'), $expected); }
/** * setUp * * @return void */ public function setUp() { parent::setUp(); App::build(array('Plugin' => array(TESTS . 'test_app' . DS . 'Plugin' . DS), 'View' => array(TESTS . 'test_app' . DS . 'View' . DS)), App::PREPEND); if (!isset($_SERVER['REMOTE_ADDR'])) { $_SERVER['REMOTE_ADDR'] = '127.0.0.1'; } CakePlugin::unload('Install'); CakePlugin::load(array('Users'), array('bootstrap' => true)); CakePlugin::load('Example'); Configure::write('Acl.database', 'test'); $Setting = ClassRegistry::init('Settings.Setting'); $Setting->settingsPath = TESTS . 'test_app' . DS . 'Config' . DS . 'settings.json'; Configure::drop('settings'); Configure::config('settings', new CroogoJsonReader(dirname($Setting->settingsPath) . DS)); CakeLog::drop('stdout'); CakeLog::drop('stderr'); $Setting->writeConfiguration(); }
/** * test adding new readers. * * @return void */ public function testReaderSetup() { $reader = new PhpReader(); Configure::config('test', $reader); $configured = Configure::configured(); $this->assertTrue(in_array('test', $configured)); $this->assertTrue(Configure::configured('test')); $this->assertFalse(Configure::configured('fake_garbage')); $this->assertTrue(Configure::drop('test')); $this->assertFalse(Configure::drop('test'), 'dropping things that do not exist should return false.'); }