예제 #1
0
    /**
     * Тест установки 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));
    }
예제 #2
0
파일: mainTest.php 프로젝트: gudwin/extasy
 /**
  * Очищаем системный реестр
  */
 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);
 }
예제 #3
0
 /**
  * Проверяем удаляется ли из кеша
  * @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');
 }
예제 #4
0
 /**
  * Попытка вставки в запись не являющейся веткой
  * @expectedException SystemRegisterException
  */
 public function testInsertToNotFolder()
 {
     $register = new SystemRegister('AddData/test1/');
     $register->insert('value1/unknown', 'new value');
 }
예제 #5
0
<?php

$register = new SystemRegister('/System/CMS/routes/administrate');
$register->insert('audit', 'class://Extasy\\Audit\\Controllers\\Audit/startup');
SystemRegisterSample::createCache();
예제 #6
0
파일: helper.php 프로젝트: gudwin/extasy
 /**
  * Импортируемт значение (может быть массивом) в реестр
  * @param $path SystemRegister узел дерева реестра
  * @param $aData mixed значение для вставки
  */
 public static function import(SystemRegister $path, $aData)
 {
     foreach ($aData as $key => $row) {
         if (!isset($path->{$key})) {
             // Создаем ключ
             // Если это массив
             if (!is_Array($row)) {
                 $path->insert($key, $row, '', gettype($row));
             } else {
                 // Если значение не является массив
                 $path->insert($key, '', '', SYSTEMREGISTER_BRANCH_TYPE);
                 self::import($path->{$key}, $row);
             }
         } else {
             // Существует ключ
             // и он  массив
             if (is_array($row)) {
                 // Если данные массив
                 // Проверяем, является ли массивом значение и является ли веткой данный узел
                 if ($path->{$key} instanceof SystemRegister) {
                     // Да, значит спукаемся по рекурсии
                     self::import($path->{$key}, $row);
                 }
             } else {
                 // Нет, не массив
                 // Обновляем значени
                 $path->{$key} = $row;
             }
         }
     }
 }