/** * Очищаем системный реестр */ 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); }
/** * Тестирование удаления элементов */ public function testDelete() { $register = new SystemRegister('/AppData'); // $register->delete('test1/value1'); // try { $szValue = $register->test1->value1->value; $this->Fail('Property must be deleted'); } catch (SystemRegisterException $e) { } }
/** * Проверяем удаляется ли из кеша * @expectedException SystemRegisterException */ public function testCacheOnDeletedItem() { $register = new SystemRegister(); $register->insert('AppData/test1/new_value', 'New Value'); // $szValue = $register->get('AppData/test1/new_value'); // $test1 = $register->get('AppData/test1'); $register->delete('AppData/test1/new_value'); // $test1->get('new_value'); }
public function tearDown() { $path = array(LIB_PATH . 'custom_config/controls/failed_to_load.php', LIB_PATH . 'custom_config/test.php', LIB_PATH . 'custom_config/test2.php'); foreach ($path as $row) { if (file_exists($row)) { unlink($row); } } $register = new SystemRegister('Applications/cconfig/user_control_path'); $child = SystemRegisterSample::selectChild($register->getId()); foreach ($child as $row) { $register->delete($row['name']); } }
<?php $register = new SystemRegister('System/CMS'); $register->delete('display_administrate_scripts'); SystemRegisterSample::clearCache();
<?php namespace Extasy\tests\Audit; use Faid\DBSimple; use Extasy\tests\Helper as TestsHelper; use UserAccount; use ACL; use Extasy\Audit\Api\ApiOperation; use Extasy\Audit\Record; use Extasy\Audit\Log; use Extasy\tests\system_register\Restorator; use Extasy\Columns\Password as passwordColumn; $register = new \SystemRegister('/System/'); try { $register->delete('Audit'); } catch (\Exception $e) { } Restorator::restore(); \SystemRegisterSample::createCache(); TestsHelper::dbFixture(ACL_TABLE, array()); ACL::create(ApiOperation::RightName); // user record TestsHelper::dbFixture(USERS_TABLE, array(array('login' => 'login', 'password' => passwordColumn::hash('testtest')), array('login' => 'guest', 'password' => passwordColumn::hash('testtest')))); // grant user permission $user = UserAccount::getByLogin('login'); ACL::grant(ApiOperation::RightName, $user->obj_rights->getEntity()); \UsersLogin::login('login', 'testtest'); // base logs TestsHelper::dbFixture(Log::getTableName(), array(array('name' => 'Log1', 'critical' => 0, 'enable_logging' => 1), array('name' => 'Log2', 'critical' => 1, 'enable_logging' => 1))); // base records
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)); }
<?php $register = new SystemRegister('/System/CMS'); $register->delete('Menu'); $register->delete('routes'); SystemRegisterSample::createCache();