コード例 #1
0
ファイル: File.php プロジェクト: agentile/foresmo
 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;
 }
コード例 #2
0
ファイル: Sql.php プロジェクト: agentile/foresmo
 /**
  * 
  * 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();
 }
コード例 #3
0
ファイル: Sql.php プロジェクト: btweedy/foresmo
 /**
  * 
  * Setup; runs after each test method.
  * 
  */
 public function teardown()
 {
     parent::teardown();
 }
コード例 #4
0
ファイル: File.php プロジェクト: btweedy/foresmo
 /**
  * 
  * 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();
 }