diff options
Diffstat (limited to 'tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php')
-rw-r--r-- | tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php | 37 |
1 files changed, 10 insertions, 27 deletions
diff --git a/tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php b/tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php index 4f1b8d25b58..b59ef876ffd 100644 --- a/tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php +++ b/tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php @@ -3,32 +3,15 @@ declare(strict_types=1); /** - * @copyright 2018 Christoph Wurst <christoph@winzerhof-wurst.at> - * - * @author 2018 Christoph Wurst <christoph@winzerhof-wurst.at> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * + * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later */ namespace Test\Authentication\TwoFactorAuth\Db; -use OC; use OC\Authentication\TwoFactorAuth\Db\ProviderUserAssignmentDao; use OCP\IDBConnection; +use OCP\Server; use Test\TestCase; /** @@ -44,7 +27,7 @@ class ProviderUserAssignmentDaoTest extends TestCase { protected function setUp(): void { parent::setUp(); - $this->dbConn = OC::$server->getDatabaseConnection(); + $this->dbConn = Server::get(IDBConnection::class); $qb = $this->dbConn->getQueryBuilder(); $q = $qb->delete(ProviderUserAssignmentDao::TABLE_NAME); $q->execute(); @@ -52,7 +35,7 @@ class ProviderUserAssignmentDaoTest extends TestCase { $this->dao = new ProviderUserAssignmentDao($this->dbConn); } - public function testGetState() { + public function testGetState(): void { $qb = $this->dbConn->getQueryBuilder(); $q1 = $qb->insert(ProviderUserAssignmentDao::TABLE_NAME)->values([ 'provider_id' => $qb->createNamedParameter('twofactor_u2f'), @@ -76,7 +59,7 @@ class ProviderUserAssignmentDaoTest extends TestCase { $this->assertEquals($expected, $state); } - public function testPersist() { + public function testPersist(): void { $qb = $this->dbConn->getQueryBuilder(); $this->dao->persist('twofactor_totp', 'user123', 0); @@ -93,7 +76,7 @@ class ProviderUserAssignmentDaoTest extends TestCase { $this->assertCount(1, $data); } - public function testPersistTwice() { + public function testPersistTwice(): void { $qb = $this->dbConn->getQueryBuilder(); $this->dao->persist('twofactor_totp', 'user123', 0); @@ -112,7 +95,7 @@ class ProviderUserAssignmentDaoTest extends TestCase { $this->assertCount(1, $data); } - public function testPersistSameStateTwice() { + public function testPersistSameStateTwice(): void { $qb = $this->dbConn->getQueryBuilder(); $this->dao->persist('twofactor_totp', 'user123', 1); @@ -131,7 +114,7 @@ class ProviderUserAssignmentDaoTest extends TestCase { $this->assertCount(1, $data); } - public function testDeleteByUser() { + public function testDeleteByUser(): void { $this->dao->persist('twofactor_fail', 'user1', 1); $this->dao->persist('twofactor_u2f', 'user1', 1); $this->dao->persist('twofactor_fail', 'user2', 0); @@ -160,7 +143,7 @@ class ProviderUserAssignmentDaoTest extends TestCase { $this->assertCount(2, $statesUser2); } - public function testDeleteAll() { + public function testDeleteAll(): void { $this->dao->persist('twofactor_fail', 'user1', 1); $this->dao->persist('twofactor_u2f', 'user1', 1); $this->dao->persist('twofactor_fail', 'user2', 0); |