public function setDSN($dsn) { if (!$this->driver) { $this->driver = DB::singleton($dsn); } }
public function init($dsn) { ORM::registerDB('pasl_rbac', DB::factory($dsn)); }
public function testPASLDriverGetInstance() { $dbDriver = \PASL\DB::singleton($this->strMyDsn, false, false); $this->assertIsA($dbDriver, 'PASL\\DB_Driver\\common'); $this->assertIsA($dbDriver, 'PASL\\DB_Driver\\mysql'); $dbDriverCmp = \PASL\DB::getInstance($this->aMyDsn['phptype'] . '_' . $this->aMyDsn['hostspec']); $this->assertIdentical($dbDriver, $dbDriverCmp); }
function TestAuth_mysql_bad_password() { $db = \PASL\DB::singleton($this->strMyDsn); $oAuth = new \PASL\Authentication('mysql'); /** * @var PASL_Authentication_Provider_mysql */ $authProvider = $oAuth->getProvider(); $authProvider->setDriver($db); $authProvider->setEncryption('none'); $authProvider->setQuery('SELECT * FROM `pasl_authentication_tests` WHERE `username`="%s" LIMIT 1'); $this->assertFalse($oAuth->authenticate($this->aBadPassword)); $oErr = $oAuth->getError(); $this->assertEqual($oErr, PASL_AUTH_BAD_PASSWORD); }