public function tearDown() { foreach (Configure::configured() as $config) { if (strpos($config, 'YamlTestConfig') !== false) { Configure::drop($config); } } Configure::write($this->_config); parent::tearDown(); }
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); }
/** * 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.'); }
/** * Find the related code folding values for $char * * @param int $char decimal value of character * @param string $type Type 'lower' or 'upper'. Defaults to 'lower'. * @return array|null */ protected static function _find($char, $type = 'lower') { $found = array(); if (!isset(self::$_codeRange[$char])) { $range = self::_codepoint($char); if ($range === false) { return null; } if (!Configure::configured('_cake_core_')) { App::uses('PhpReader', 'Configure'); Configure::config('_cake_core_', new PhpReader(CAKE . 'Config' . DS)); } Configure::load('unicode' . DS . 'casefolding' . DS . $range, '_cake_core_'); self::$_caseFold[$range] = Configure::read($range); Configure::delete($range); } if (!self::$_codeRange[$char]) { return null; } self::$_table = self::$_codeRange[$char]; $count = count(self::$_caseFold[self::$_table]); for ($i = 0; $i < $count; $i++) { if ($type === 'lower' && self::$_caseFold[self::$_table][$i][$type][0] === $char) { $found[] = self::$_caseFold[self::$_table][$i]; } elseif ($type === 'upper' && self::$_caseFold[self::$_table][$i][$type] === $char) { $found[] = self::$_caseFold[self::$_table][$i]; } } return $found; }
/** * Setup configuration reader. * * @param mixed $config Optional. Reader configuration options as array or just name (i.e. ini) * @param boolean $default Optional. If true, make this configuration the default one. * @return array Full configuration settings. */ public static function reader($config = null, $default = false) { if (empty($config)) { $config = array('id' => 'json', 'className' => 'JsonReader', 'location' => 'Common.Configure'); } if (!is_array($config)) { $config = array('id' => $config, 'className' => ucfirst($config) . 'Reader', 'location' => 'Configure'); } extract($config); if (Configure::configured($id)) { throw new ConfigureException(__d('_common_', "A reader with the '%s' name already exists.", $id)); } foreach (array('id', 'className', 'location') as $var) { if (!isset(${$var}) || empty(${$var})) { throw new ConfigureException(__d('_common_', "Reader configuration missing the '%s' key.", $key)); } } App::uses($className, $location); Configure::config($default ? 'default' : $id, new $className()); return $config; }