コード例 #1
0
ファイル: DBTest.php プロジェクト: jasny/Q
 /**
  * Init test
  */
 public function setUp()
 {
     try {
         $this->conn = DB::connect('mysql', "localhost", "qtest");
     } catch (Exception $e) {
         $this->markTestSkipped("Failed to connect to database. Please create a user 'qtest' with all privileges to database 'qtest'. " . $e->getMessage());
     }
     $this->createTestSchema();
     $this->Auth = Auth::with('db');
     $this->Auth->query = $this->conn->prepare("SELECT id, fullname, username, '%', password, VALUES (SELECT `group` FROM `user_group` ORDER BY `group` CASCADE ON `user_group`.`user_id`=`user`.`id`) AS `groups`, `status` != 'PASSIVE' AS `active`, IF(`status` = 'NEW', 1, NULL) AS `expire` FROM `user`");
     $this->Auth->onLoginQuery = $this->conn->prepare("SET @auth_uid = :id, @auth_username = :username, @auth_fullname = :fullname");
     $this->Auth->onLogoutQuery = $this->conn->prepare("SET @auth_uid = NULL, @auth_username = NULL, @auth_fullname = NULL");
     parent::setUp();
 }
コード例 #2
0
ファイル: ManualTest.php プロジェクト: jasny/Q
 /**
  * Prepares the environment before running a test.
  */
 protected function setUp()
 {
     $this->Auth = Auth::with('manual');
     $this->Auth->users = array((object) array('id' => 1, 'fullname' => "Mark Monkey", 'username' => 'monkey', 'password' => md5('mark'), 'roles' => 'primate', 'active' => true, 'expires' => null), (object) array('id' => 2, 'fullname' => "Ben Baboon", 'username' => 'baboon', 'password' => md5('ben'), 'roles' => array('ape', 'primate'), 'active' => false, 'expires' => null), (object) array('id' => 3, 'fullname' => "George Gorilla", 'username' => 'gorilla', 'password' => md5('george'), 'roles' => array('ape', 'primate'), 'active' => true, 'expires' => 1));
     parent::setUp();
 }