示例#1
0
 function test_mysqlstore()
 {
     // If the mysql extension isn't loaded or loadable, succeed
     // because we can't run the test.
     if (!(extension_loaded('mysql') || @dl('mysql.' . PHP_SHLIB_SUFFIX))) {
         print "(not testing MySQL store)";
         $this->pass();
         return;
     }
     require_once 'Auth/OpenID/MySQLStore.php';
     require_once 'DB.php';
     global $_Auth_OpenID_db_test_host;
     $dsn = array('phptype' => 'mysql', 'username' => 'openid_test', 'password' => '', 'hostspec' => $_Auth_OpenID_db_test_host);
     $db =& DB::connect($dsn);
     if (PEAR::isError($db)) {
         print "MySQL database connection failed: " . $db->getMessage();
         $this->pass();
         return;
     }
     $temp_db_name = _Auth_OpenID_getTmpDbName();
     $result = $db->query("CREATE DATABASE {$temp_db_name}");
     if (PEAR::isError($result)) {
         $this->pass("Error creating MySQL temporary database: " . $result->getMessage());
         return;
     }
     $db->query("USE {$temp_db_name}");
     $store =& new Auth_OpenID_MySQLStore($db);
     $store->createTables();
     $this->_testStore($store);
     $this->_testNonce($store);
     $this->_testNonceCleanup($store);
     $db->query("DROP DATABASE {$temp_db_name}");
 }
示例#2
0
 function test_mysqlstore()
 {
     global $_Auth_OpenID_db_test_host;
     $dsn = array('phptype' => 'mysql', 'username' => 'openid_test', 'password' => '', 'hostspec' => $_Auth_OpenID_db_test_host);
     $db = dbLayerTransaction::getInstance('mysql', 'localhost', 'test', 'root', '', false);
     $temp_db_name = _Auth_OpenID_getTmpDbName();
     $result = $db->query("CREATE DATABASE {$temp_db_name}");
     $db = dbLayerTransaction::getInstance('mysql', 'localhost', $temp_db_name, 'root', '', false);
     $store =& new WMySqlStore($db);
     $store->createTables();
     $this->_testStore($store);
     $this->_testNonce($store);
     $this->_testNonceCleanup($store);
     $db->query("DROP DATABASE {$temp_db_name}");
 }
示例#3
0
 function test_mdb2store()
 {
     // The MDB2 test can use any database engine. MySQL is chosen
     // arbitrarily.
     if (!(extension_loaded('mysql') || function_exists('dl') && @dl('mysql.' . PHP_SHLIB_SUFFIX)) || !@(include_once 'MDB2.php')) {
         print "(not testing MDB2 store)";
         $this->pass();
         return;
     }
     require_once 'Auth/OpenID/MDB2Store.php';
     global $_Auth_OpenID_db_test_host;
     $dsn = array('phptype' => 'mysql', 'username' => 'openid_test', 'password' => '', 'hostspec' => $_Auth_OpenID_db_test_host);
     $db =& MDB2::connect($dsn);
     if (PEAR::isError($db)) {
         print "MySQL database connection failed: " . $db->getMessage();
         $this->pass();
         return;
     }
     $temp_db_name = _Auth_OpenID_getTmpDbName();
     $result = $db->query("CREATE DATABASE {$temp_db_name}");
     if (PEAR::isError($result)) {
         $this->pass("Error creating MySQL temporary database: " . $result->getMessage());
         return;
     }
     $db->query("USE {$temp_db_name}");
     $store =& new Auth_OpenID_MDB2Store($db);
     if (!$store->createTables()) {
         $this->fail("Failed to create tables");
         return;
     }
     $this->_testStore($store);
     $this->_testNonce($store);
     $this->_testNonceCleanup($store);
     $db->query("DROP DATABASE {$temp_db_name}");
 }
示例#4
0
 function test_mysqlstore()
 {
     global $_Auth_OpenID_db_test_host;
     $db = DbLayerTransSingleton::getInstance('mysql', 'localhost', 'test', 'root', '', false);
     $temp_db_name = _Auth_OpenID_getTmpDbName();
     $result = $db->execute("CREATE DATABASE {$temp_db_name}");
     $db = DbLayerTransSingleton::getInstance('mysql', 'localhost', $temp_db_name, 'root', '', false);
     $result = $db->execute("USE {$temp_db_name}");
     $store =& new WMySqlStore($db);
     $store->createTables();
     $this->_testStore($store);
     $this->_testNonce($store);
     $this->_testNonceCleanup($store);
     $db->execute("DROP DATABASE {$temp_db_name}");
 }