abstract away the global $DB

This commit is contained in:
Spine
2023-03-08 18:29:06 +01:00
parent 8a0a2ce529
commit e3ba156a69
86 changed files with 408 additions and 348 deletions
+2 -4
View File
@@ -17,8 +17,7 @@ class RequestTest extends TestCase {
$this->request->remove();
}
// TODO: Make it easier to reset user upload/download
global $DB;
$DB->prepared_query("
Gazelle\DB::DB()->prepared_query("
UPDATE users_leech_stats SET Uploaded = ? WHERE UserID = ?
", STARTING_UPLOAD, (new Gazelle\Manager\User)->find('@user')->id()
);
@@ -165,8 +164,7 @@ class RequestTest extends TestCase {
'bounty-size' => $user->stats()->requestBountySize(),
'bounty-total' => $user->stats()->requestBountyTotal(),
];
global $DB;
$torrentId = $DB->scalar("SELECT min(ID) FROM torrents");
$torrentId = Gazelle\DB::DB()->scalar("SELECT min(ID) FROM torrents");
$torrent = (new Gazelle\Manager\Torrent)->findById($torrentId);
$this->assertInstanceOf(Gazelle\Torrent::class, $torrent, 'request-torrent-filler');
$this->assertEquals(1, $request->fill($user, $torrent), 'request-fill');