Example #1
0
 protected function _preConfig()
 {
     parent::_preConfig();
     $dir = Solar_Class::dir('Mock_Solar_Access_Adapter');
     $file = $dir . 'access.txt';
     $this->_Test_Solar_Access_Adapter_File['file'] = $file;
 }
Example #2
0
 /**
  * 
  * Setup; runs before each test method.
  * 
  */
 public function preTest()
 {
     $this->_sql = Solar::factory('Solar_Sql', array('adapter' => 'Solar_Sql_Adapter_Sqlite', 'name' => ':memory:'));
     // forcibly add sql to registry
     Solar_Registry::set('sql', $this->_sql);
     $cmd = "CREATE TABLE acl (" . "    flag VARCHAR(10)," . "    type CHAR(100)," . "    name VARCHAR(255)," . "    class_name VARCHAR(255)," . "    action_name VARCHAR(255)," . "    position VARCHAR(255)" . ")";
     $this->_sql->query($cmd);
     $dir = Solar_Class::dir('Mock_Solar_Access_Adapter');
     $lines = file_get_contents($dir . 'access.txt');
     $rows = explode("\n", $lines);
     $pos = 0;
     foreach ($rows as $row) {
         $row = trim($row);
         // skip empty lines and comments
         if (empty($row) || substr($row, 0, 1) == '#') {
             continue;
         }
         $row = preg_replace('/[ \\t]{2,}/', ' ', $row);
         $row = explode(' ', $row);
         $data['flag'] = trim($row[0]);
         $data['type'] = trim($row[1]);
         $data['name'] = trim($row[2]);
         $data['class_name'] = trim($row[3]);
         $data['action_name'] = trim($row[4]);
         $data['position'] = $pos;
         $this->_sql->insert('acl', $data);
         $pos++;
     }
     parent::preTest();
 }
Example #3
0
 /**
  * 
  * Setup; runs after each test method.
  * 
  */
 public function teardown()
 {
     parent::teardown();
 }
Example #4
0
 /**
  * 
  * Setup; runs before each test method.
  * 
  */
 public function setup()
 {
     $dir = Solar_Class::dir('Test_Solar_Access_Adapter', '_support');
     $this->_config['file'] = $dir . 'access.txt';
     parent::setup();
 }