/** * @test * @group library */ public function defaultCodeLengthIsUsedWhenCodeLengthIsNotConfigured() { $config = Registry::getConfig(); Registry::setConfig(new \Zend_Config(array())); $this->assertEquals(OptinCodeGenerator::DEFAULT_CODE_LENGTH, strlen(OptinCodeGenerator::generate())); Registry::setConfig($config); }
protected function _initConfig() { $configOptions = $this->getOptions(); $config = new Zend_Config($configOptions, true); Registry::setConfig($config); return $config; }
protected function updateConfigModuleEnableDev($enable) { // set quota in config $newConfig = new \Zend_Config(Registry::getConfig()->toArray(), true); $newConfig->quota->module->enableDev = $enable; $newConfig->setReadOnly(); Registry::setConfig($newConfig); }
/** * @param boolean $enableDev */ protected function setQuotaModuleEnableDev($enableDev) { $config = Registry::getConfig(); $newConfig = new \Zend_Config($config->toArray(), true); $newConfig->quota->module->enableDev = $enableDev; $newConfig->setReadOnly(); Registry::setConfig($newConfig); }
/** * @param array $pathToValue */ public static function removeValue(array $pathToValue) { $config = Registry::getConfig()->toArray(); if (count($pathToValue) <= 0) { $config = array(); } else { $configPart =& $config; foreach (array_slice($pathToValue, 0, -1) as $key) { if (!array_key_exists($key, $configPart)) { return; } $configPart =& $configPart[$key]; } unset($configPart[end($pathToValue)]); } $newConfig = new \Zend_Config($config, true); $newConfig->setReadOnly(); Registry::setConfig($newConfig); }