diff options
Diffstat (limited to 'apps/twofactor_backupcodes/tests/Db/BackupCodeMapperTest.php')
-rw-r--r-- | apps/twofactor_backupcodes/tests/Db/BackupCodeMapperTest.php | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/apps/twofactor_backupcodes/tests/Db/BackupCodeMapperTest.php b/apps/twofactor_backupcodes/tests/Db/BackupCodeMapperTest.php index ce373aea1d9..19cab51969b 100644 --- a/apps/twofactor_backupcodes/tests/Db/BackupCodeMapperTest.php +++ b/apps/twofactor_backupcodes/tests/Db/BackupCodeMapperTest.php @@ -12,21 +12,16 @@ use OCA\TwoFactorBackupCodes\Db\BackupCode; use OCA\TwoFactorBackupCodes\Db\BackupCodeMapper; use OCP\IDBConnection; use OCP\IUser; +use OCP\Server; use Test\TestCase; /** * @group DB */ class BackupCodeMapperTest extends TestCase { - - /** @var IDBConnection */ - private $db; - - /** @var BackupCodeMapper */ - private $mapper; - - /** @var string */ - private $testUID = 'test123456'; + private IDBConnection $db; + private BackupCodeMapper $mapper; + private string $testUID = 'test123456'; private function resetDB() { $qb = $this->db->getQueryBuilder(); @@ -38,8 +33,8 @@ class BackupCodeMapperTest extends TestCase { protected function setUp(): void { parent::setUp(); - $this->db = \OC::$server->getDatabaseConnection(); - $this->mapper = \OC::$server->query(BackupCodeMapper::class); + $this->db = Server::get(IDBConnection::class); + $this->mapper = Server::get(BackupCodeMapper::class); $this->resetDB(); } @@ -50,7 +45,7 @@ class BackupCodeMapperTest extends TestCase { $this->resetDB(); } - public function testGetBackupCodes() { + public function testGetBackupCodes(): void { $code1 = new BackupCode(); $code1->setUserId($this->testUID); $code1->setCode('1|$2y$10$Fyo.DkMtkaHapVvRVbQBeeIdi5x/6nmPnxiBzD0GDKa08NMus5xze'); @@ -76,7 +71,7 @@ class BackupCodeMapperTest extends TestCase { $this->assertInstanceOf(BackupCode::class, $dbCodes[1]); } - public function testDeleteCodes() { + public function testDeleteCodes(): void { $code = new BackupCode(); $code->setUserId($this->testUID); $code->setCode('1|$2y$10$CagG8pEhZL.xDirtCCP/KuuWtnsAasgq60zY9rU46dBK4w8yW0Z/y'); @@ -95,7 +90,7 @@ class BackupCodeMapperTest extends TestCase { $this->assertCount(0, $this->mapper->getBackupCodes($user)); } - public function testInsertArgonEncryptedCodes() { + public function testInsertArgonEncryptedCodes(): void { $code = new BackupCode(); $code->setUserId($this->testUID); $code->setCode('2|$argon2i$v=19$m=1024,t=2,p=2$MjJWUjRFWndtMm5BWGxOag$BusVxLeFyiLLWtaVvX/JRFBiPdZcjRrzpQ/rAhn6vqY'); |