/** * Тест установки sitemap-индекса к конфигу */ public function testSelectControlNames() { SystemRegisterSample::clearCache(); $fileList = \DAO_FileSystem::getInstance()->getFileList(LIB_PATH . 'custom_config/controls/'); $list = CConfigControlManager::selectAll(); $this->assertEquals(sizeof($fileList), sizeof($list)); // Добавляем в реестр файлег, но не пишем класс $path = LIB_PATH . 'custom_config/test.php'; $register = new SystemRegister('Applications/cconfig/user_control_path'); $register->insert('test', $path, ''); file_put_contents($path, ''); $list = CConfigControlManager::selectAll(); $this->assertEquals(sizeof($fileList), sizeof($list)); // Заполняем инфо о классе, таким образом класс становится доступным $path = 'custom_config/test2.php'; $contents = <<<EOD <? class CConfigControl_Test2 extends CConfigBaseControl { \tpublic function getXType() { \t\treturn "test2"; \t} } ?> EOD; file_put_contents(LIB_PATH . $path, $contents); $register->insert('test2', $path, ''); $list = CConfigControlManager::selectAll(); $this->assertEquals(sizeof($fileList) + 1, sizeof($list)); }
/** * Очищаем системный реестр */ protected function clearSystemRegister() { SystemRegisterSample::clearCache(); $register = new SystemRegister('Applications/cconfig'); $register->delete('user_control_path'); SystemRegisterSample::clearCache(); $register->insert('user_control_path', null, '', SYSTEMREGISTER_BRANCH_TYPE); }
<?php $register = new SystemRegister('System/CMS'); $register->delete('display_administrate_scripts'); SystemRegisterSample::clearCache();
public function testImportUpdatingFileCacheWithDeletion() { $system = new SystemRegister('/System/'); $this->assertEquals(false, isset($system->array)); SystemRegisterHelper::import($system, array('XX' => '1', 'yy' => '2', 'Gisma' => 'rulit!', 'array' => array('0' => 'value1', '1' => array('1' => '2', '3' => '4')))); $this->assertEquals(true, isset($system->array)); // SystemRegisterSample::loadAll(); $base = new SystemRegister('System'); $this->assertEquals(true, isset($system->array)); $base->delete('array'); $this->assertEquals(false, isset($base->array)); // SystemRegisterSample::clearCache(); SystemRegisterSample::loadAll(); $system = new SystemRegister('/System/'); $this->assertEquals(false, isset($base->array)); }
public function tearDown() { SystemRegisterSample::clearCache(); \Extasy\tests\system_register\Restorator::restore(); }