aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.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/PublicKeyTokenProviderTest.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/PublicKeyTokenProviderTest.php')
-rw-r--r--tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php50
1 files changed, 25 insertions, 25 deletions
diff --git a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
index e2ca4350f29..be90d60c64f 100644
--- a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
+++ b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
@@ -84,7 +84,7 @@ class PublicKeyTokenProviderTest extends TestCase {
);
}
- public function testGenerateToken() {
+ public function testGenerateToken(): void {
$token = 'tokentokentokentokentoken';
$uid = 'user';
$user = 'User';
@@ -129,7 +129,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->tokenProvider->getPassword($actual, $token);
}
- public function testGenerateTokenLongPassword() {
+ public function testGenerateTokenLongPassword(): void {
$token = 'tokentokentokentokentoken';
$uid = 'user';
$user = 'User';
@@ -148,7 +148,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$actual = $this->tokenProvider->generateToken($token, $uid, $user, $password, $name, $type, IToken::DO_NOT_REMEMBER);
}
- public function testGenerateTokenInvalidName() {
+ public function testGenerateTokenInvalidName(): void {
$token = 'tokentokentokentokentoken';
$uid = 'user';
$user = 'User';
@@ -173,7 +173,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->assertSame($password, $this->tokenProvider->getPassword($actual, $token));
}
- public function testUpdateToken() {
+ public function testUpdateToken(): void {
$tk = new PublicKeyToken();
$this->mapper->expects($this->once())
->method('updateActivity')
@@ -189,7 +189,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->assertEquals($this->time, $tk->getLastActivity());
}
- public function testUpdateTokenDebounce() {
+ public function testUpdateTokenDebounce(): void {
$tk = new PublicKeyToken();
$this->config->method('getSystemValueInt')
->willReturnCallback(function ($value, $default) {
@@ -204,7 +204,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->tokenProvider->updateTokenActivity($tk);
}
- public function testGetTokenByUser() {
+ public function testGetTokenByUser(): void {
$this->mapper->expects($this->once())
->method('getTokenByUser')
->with('uid')
@@ -213,7 +213,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->assertEquals(['token'], $this->tokenProvider->getTokenByUser('uid'));
}
- public function testGetPassword() {
+ public function testGetPassword(): void {
$token = 'tokentokentokentokentoken';
$uid = 'user';
$user = 'User';
@@ -231,7 +231,7 @@ class PublicKeyTokenProviderTest extends TestCase {
}
- public function testGetPasswordPasswordLessToken() {
+ public function testGetPasswordPasswordLessToken(): void {
$this->expectException(\OC\Authentication\Exceptions\PasswordlessTokenException::class);
$token = 'token1234';
@@ -242,7 +242,7 @@ class PublicKeyTokenProviderTest extends TestCase {
}
- public function testGetPasswordInvalidToken() {
+ public function testGetPasswordInvalidToken(): void {
$this->expectException(\OC\Authentication\Exceptions\InvalidTokenException::class);
$token = 'tokentokentokentokentoken';
@@ -261,7 +261,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->tokenProvider->getPassword($actual, 'wrongtoken');
}
- public function testSetPassword() {
+ public function testSetPassword(): void {
$token = 'tokentokentokentokentoken';
$uid = 'user';
$user = 'User';
@@ -293,7 +293,7 @@ class PublicKeyTokenProviderTest extends TestCase {
}
- public function testSetPasswordInvalidToken() {
+ public function testSetPasswordInvalidToken(): void {
$this->expectException(\OC\Authentication\Exceptions\InvalidTokenException::class);
$token = $this->createMock(IToken::class);
@@ -303,7 +303,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->tokenProvider->setPassword($token, $tokenId, $password);
}
- public function testInvalidateToken() {
+ public function testInvalidateToken(): void {
$this->mapper->expects($this->exactly(2))
->method('invalidate')
->withConsecutive(
@@ -314,7 +314,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->tokenProvider->invalidateToken('token7');
}
- public function testInvalidateTokenById() {
+ public function testInvalidateTokenById(): void {
$id = 123;
$this->mapper->expects($this->once())
@@ -348,7 +348,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->tokenProvider->invalidateOldTokens();
}
- public function testInvalidateLastUsedBefore() {
+ public function testInvalidateLastUsedBefore(): void {
$this->mapper->expects($this->once())
->method('invalidateLastUsedBefore')
->with('user', 946684800);
@@ -356,7 +356,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->tokenProvider->invalidateLastUsedBefore('user', 946684800);
}
- public function testRenewSessionTokenWithoutPassword() {
+ public function testRenewSessionTokenWithoutPassword(): void {
$token = 'oldIdtokentokentokentoken';
$uid = 'user';
$user = 'User';
@@ -450,7 +450,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->assertSame($token, $this->tokenProvider->getToken('unhashedTokentokentokentokentoken'));
}
- public function testGetInvalidToken() {
+ public function testGetInvalidToken(): void {
$this->expectException(InvalidTokenException::class);
$this->mapper->expects($this->exactly(2))
@@ -467,7 +467,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->tokenProvider->getToken('unhashedTokentokentokentokentoken');
}
- public function testGetExpiredToken() {
+ public function testGetExpiredToken(): void {
$token = 'tokentokentokentokentoken';
$uid = 'user';
$user = 'User';
@@ -493,7 +493,7 @@ class PublicKeyTokenProviderTest extends TestCase {
}
}
- public function testGetTokenById() {
+ public function testGetTokenById(): void {
$token = $this->createMock(PublicKeyToken::class);
$this->mapper->expects($this->once())
@@ -504,7 +504,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->assertSame($token, $this->tokenProvider->getTokenById(42));
}
- public function testGetInvalidTokenById() {
+ public function testGetInvalidTokenById(): void {
$this->expectException(InvalidTokenException::class);
$this->mapper->expects($this->once())
@@ -515,7 +515,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->tokenProvider->getTokenById(42);
}
- public function testGetExpiredTokenById() {
+ public function testGetExpiredTokenById(): void {
$token = new PublicKeyToken();
$token->setExpires(42);
@@ -532,7 +532,7 @@ class PublicKeyTokenProviderTest extends TestCase {
}
}
- public function testRotate() {
+ public function testRotate(): void {
$token = 'oldtokentokentokentokentoken';
$uid = 'user';
$user = 'User';
@@ -551,7 +551,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->assertSame('password', $this->tokenProvider->getPassword($new, 'newtokentokentokentokentoken'));
}
- public function testRotateNoPassword() {
+ public function testRotateNoPassword(): void {
$token = 'oldtokentokentokentokentoken';
$uid = 'user';
$user = 'User';
@@ -571,7 +571,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->assertNull($new->getPassword());
}
- public function testMarkPasswordInvalidInvalidToken() {
+ public function testMarkPasswordInvalidInvalidToken(): void {
$token = $this->createMock(IToken::class);
$this->expectException(InvalidTokenException::class);
@@ -579,7 +579,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->tokenProvider->markPasswordInvalid($token, 'tokenId');
}
- public function testMarkPasswordInvalid() {
+ public function testMarkPasswordInvalid(): void {
$token = $this->createMock(PublicKeyToken::class);
$token->expects($this->once())
@@ -592,7 +592,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->tokenProvider->markPasswordInvalid($token, 'tokenId');
}
- public function testUpdatePasswords() {
+ public function testUpdatePasswords(): void {
$uid = 'myUID';
$token1 = $this->tokenProvider->generateToken(
'foobetokentokentokentoken',