本文整理汇总了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());
}
}