本文整理匯總了PHP中TestManager::clearDatabase方法的典型用法代碼示例。如果您正苦於以下問題:PHP TestManager::clearDatabase方法的具體用法?PHP TestManager::clearDatabase怎麽用?PHP TestManager::clearDatabase使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TestManager
的用法示例。
在下文中一共展示了TestManager::clearDatabase方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testError
public function testError()
{
TestManager::clearDatabase();
$database = new DatabaseManager();
$resource = $database->query("SELECT `garbage` FROM `thingthatdoesnotexist`");
$this->assertEquals(false, $resource);
$this->assertNotEquals("", $database->error());
}
示例2: loadBasicDummyData
public static function loadBasicDummyData()
{
TestManager::clearDatabase();
$database = new DatabaseManager();
UserManager::verifyTable($database);
AddonManager::verifyTable($database);
BoardManager::verifyTable($database);
TagManager::verifyTable($database);
GroupManager::verifyTable($database);
DependencyManager::verifyTable($database);
CommentManager::verifyTable($database);
RatingManager::verifyTable($database);
BuildManager::verifyTable($database);
StatManager::verifyTable($database);
ScreenshotManager::verifyTable($database);
if (!$database->query("INSERT INTO `addon_boards` (name, video, description) VALUES ('General Content', 'general_content_bg', 'Bricks, Events, Sounds, Prints, Environments, and much more!')")) {
throw new Exception("Database error: " . $database->error());
}
if (!$database->query("INSERT INTO `addon_boards` (name, video, description) VALUES ('Minigames', 'minigames_bg', 'Weapons, Vehicles, Gamemodes, and all your gaming needs!')")) {
throw new Exception("Database error: " . $database->error());
}
if (!$database->query("INSERT INTO `addon_boards` (name, video, description) VALUES ('Client Mods', 'client_mods_bg', 'Mods that run on your client.')")) {
throw new Exception("Database error: " . $database->error());
}
if (!$database->query("INSERT INTO `addon_boards` (name, video, description) VALUES ('Bargain Bin', 'bargain_bin_bg', 'A home for \\'special\\' content.')")) {
throw new Exception("Database error: " . $database->error());
}
if (!$database->query("INSERT INTO `users` (username, blid, password, email, salt, verified) VALUES ('testuser', '4833', '1d8436e97ef95a7a6151f47b909167c77cfe1985ee5500efa8d46cfe825abc59', 'email@email.com', '273eb4', '1')")) {
throw new Exception("Database error: " . $database->error());
}
//the default json types likely need to be reworked
if (!$database->query("INSERT INTO `addon_addons` (board, blid, name, filename, description, approved, versionInfo, authorInfo, reviewInfo) VALUES ('1', '4833', 'crapy adon', 'sciprt_hax.zip', 'bad addone pls delete', '1', '{}', '[]', '[]')")) {
throw new Exception("Database error: " . $database->error());
}
StatManager::addStatsToAddon(1);
if (!$database->query("INSERT INTO `addon_tags` (name, base_color, icon) VALUES ('dum tag', 'ff6600', 'brokenimage')")) {
throw new Exception("Database error: " . $database->error());
}
if (!$database->query("INSERT INTO `addon_tagmap` (aid, tid) VALUES ('1', '1')")) {
throw new Exception("Database error: " . $database->error());
}
if (!$database->query("INSERT INTO `group_groups` (leader, name, description, color, icon) VALUES ('4833', 'legion of dumies', 'a group for people who just want to be in a group', '00ff00', 'brokenimage')")) {
throw new Exception("Database error: " . $database->error());
}
if (!$database->query("INSERT INTO `group_usermap` (gid, blid, administrator) VALUES ('1', '4833', '1')")) {
throw new Exception("Database error: " . $database->error());
}
if (!$database->query("INSERT INTO `addon_comments` (blid, aid, comment) VALUES ('4833', '1', 'glorious addon comrade')")) {
throw new Exception("Database error: " . $database->error());
}
if (!$database->query("INSERT INTO `addon_ratings` (blid, aid, rating) VALUES ('4833', '1', '1')")) {
throw new Exception("Database error: " . $database->error());
}
}