Ejemplo n.º 1
0
 /**
  * Set up the test case
  */
 public function setUp()
 {
     parent::setUp();
     $dir = Enlight_TestHelper::Instance()->TestPath('TempFiles');
     $this->db = Enlight_Components_Db::factory('PDO_SQLITE', array('dbname' => Enlight_TestHelper::Instance()->TestPath('TempFiles') . 'auth.db'));
     $this->lockeduntilColumn = 'lockeduntil';
     $this->createDb($this->lockeduntilColumn);
     $this->createDefaultUser($this->lockeduntilColumn);
     // Needed to simulate web environment - otherwise we would get a nasty notice.
     $GLOBALS['_SESSION'] = array();
     Zend_Session::$_unitTestEnabled = true;
     Zend_Session::start();
     $this->auth = Enlight_Components_Auth::getInstance();
     $this->authAdapter = new Enlight_Components_Auth_Adapter_DbTable($this->db, 'test_auth', 'username', 'password');
     $this->authAdapter->setIdentityColumn('username')->setCredentialColumn('password')->setExpiryColumn('lastlogin')->setSessionIdColumn('sessionID')->setSessionId('s4inr04o6apmclk7u88qau4r57');
     $storage = new Zend_Auth_Storage_Session('Enlight', 'Auth');
     $this->auth->setAdapter($this->authAdapter);
     $this->assertInstanceOf('Enlight_Components_Auth_Adapter_DbTable', $this->auth->getAdapter());
     $this->auth->setStorage($storage);
 }