aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2024-09-15 22:32:31 +0200
committerChristoph Wurst <christoph@winzerhof-wurst.at>2024-09-15 22:32:31 +0200
commit49dd79eabb2b8902559a7a4e8f8fcad54f46b604 (patch)
tree2af18db46ba463368dc4461d7436fb69577923de /tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php
parent4281ce6fa1bb8235426099d720734d2394bec203 (diff)
downloadnextcloud-server-49dd79eabb2b8902559a7a4e8f8fcad54f46b604.tar.gz
nextcloud-server-49dd79eabb2b8902559a7a4e8f8fcad54f46b604.zip
refactor: Add void return type to PHPUnit test methods
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php')
-rw-r--r--tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php28
1 files changed, 14 insertions, 14 deletions
diff --git a/tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php b/tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php
index 137618a965a..7cc4e77ecb2 100644
--- a/tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php
+++ b/tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php
@@ -121,7 +121,7 @@ class PublicKeyTokenMapperTest extends TestCase {
return (int)$result['count'];
}
- public function testInvalidate() {
+ public function testInvalidate(): void {
$token = '9c5a2e661482b65597408a6bb6c4a3d1af36337381872ac56e445a06cdb7fea2b1039db707545c11027a4966919918b19d875a8b774840b18c6cbb7ae56fe206';
$this->mapper->invalidate($token);
@@ -129,7 +129,7 @@ class PublicKeyTokenMapperTest extends TestCase {
$this->assertSame(4, $this->getNumberOfTokens());
}
- public function testInvalidateInvalid() {
+ public function testInvalidateInvalid(): void {
$token = 'youwontfindthisoneinthedatabase';
$this->mapper->invalidate($token);
@@ -137,7 +137,7 @@ class PublicKeyTokenMapperTest extends TestCase {
$this->assertSame(5, $this->getNumberOfTokens());
}
- public function testInvalidateOld() {
+ public function testInvalidateOld(): void {
$olderThan = $this->time - 60 * 60; // One hour
$this->mapper->invalidateOld($olderThan);
@@ -145,7 +145,7 @@ class PublicKeyTokenMapperTest extends TestCase {
$this->assertSame(4, $this->getNumberOfTokens());
}
- public function testInvalidateLastUsedBefore() {
+ public function testInvalidateLastUsedBefore(): void {
$before = $this->time - 60 * 2; // Two minutes
$this->mapper->invalidateLastUsedBefore('user3', $before);
@@ -153,7 +153,7 @@ class PublicKeyTokenMapperTest extends TestCase {
$this->assertSame(4, $this->getNumberOfTokens());
}
- public function testGetToken() {
+ public function testGetToken(): void {
$token = new PublicKeyToken();
$token->setUid('user2');
$token->setLoginName('User2');
@@ -177,7 +177,7 @@ class PublicKeyTokenMapperTest extends TestCase {
}
- public function testGetInvalidToken() {
+ public function testGetInvalidToken(): void {
$this->expectException(\OCP\AppFramework\Db\DoesNotExistException::class);
$token = 'thisisaninvalidtokenthatisnotinthedatabase';
@@ -185,7 +185,7 @@ class PublicKeyTokenMapperTest extends TestCase {
$this->mapper->getToken($token);
}
- public function testGetTokenById() {
+ public function testGetTokenById(): void {
$token = new PublicKeyToken();
$token->setUid('user2');
$token->setLoginName('User2');
@@ -209,14 +209,14 @@ class PublicKeyTokenMapperTest extends TestCase {
}
- public function testGetTokenByIdNotFound() {
+ public function testGetTokenByIdNotFound(): void {
$this->expectException(\OCP\AppFramework\Db\DoesNotExistException::class);
$this->mapper->getTokenById(-1);
}
- public function testGetInvalidTokenById() {
+ public function testGetInvalidTokenById(): void {
$this->expectException(\OCP\AppFramework\Db\DoesNotExistException::class);
$id = '42';
@@ -224,15 +224,15 @@ class PublicKeyTokenMapperTest extends TestCase {
$this->mapper->getToken($id);
}
- public function testGetTokenByUser() {
+ public function testGetTokenByUser(): void {
$this->assertCount(2, $this->mapper->getTokenByUser('user1'));
}
- public function testGetTokenByUserNotFound() {
+ public function testGetTokenByUserNotFound(): void {
$this->assertCount(0, $this->mapper->getTokenByUser('user1000'));
}
- public function testGetById() {
+ public function testGetById(): void {
/** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$qb = $this->dbConnection->getQueryBuilder();
@@ -246,7 +246,7 @@ class PublicKeyTokenMapperTest extends TestCase {
$this->assertEquals('user1', $token->getUID());
}
- public function testDeleteByName() {
+ public function testDeleteByName(): void {
$qb = $this->dbConnection->getQueryBuilder();
$qb->select('name')
->from('authtoken')
@@ -257,7 +257,7 @@ class PublicKeyTokenMapperTest extends TestCase {
$this->assertEquals(4, $this->getNumberOfTokens());
}
- public function testHasExpiredTokens() {
+ public function testHasExpiredTokens(): void {
$this->assertFalse($this->mapper->hasExpiredTokens('user1'));
$this->assertTrue($this->mapper->hasExpiredTokens('user3'));
}