예제 #1
0
파일: SqlTest.php 프로젝트: btweedy/foresmo
 public function setup()
 {
     $this->_sql = Solar::factory('Solar_Sql', array('adapter' => 'Solar_Sql_Adapter_Sqlite', 'name' => ':memory:'));
     $cmd = "\n            CREATE TABLE roles (\n                  handle VARCHAR(255)\n                 ,name CHAR(32)\n            )";
     $this->_sql->query($cmd);
     $roles = parse_ini_file(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'roles.ini', true);
     foreach ($roles as $role => $val) {
         $handles = explode(',', $val['handles']);
         $insert = array();
         foreach ($handles as $handle) {
             $data['handle'] = trim($handle);
             $data['name'] = $role;
             $this->_sql->insert('roles', $data);
         }
     }
     $this->_config['table'] = 'roles';
     $this->_config['handle_col'] = 'handle';
     $this->_config['role_col'] = 'name';
     $this->_config['sql'] = $this->_sql;
     parent::setup();
 }
예제 #2
0
 public function setup()
 {
     $this->_config['file'] = dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'roles.txt';
     parent::setup();
 }