diff options
author | Carl Schwan <carl@carlschwan.eu> | 2022-10-17 16:02:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-17 16:02:58 +0200 |
commit | 99191167167dd6c98dc3ae9b0eca947526e7939f (patch) | |
tree | f4f9f54791d136d861738f93749238fd0708a705 /tests/lib/Authentication | |
parent | 44d2eb8b4ec838652089be6018ae7240663781df (diff) | |
parent | ef31396727771eb771b450e91e7b097b2ca151b9 (diff) | |
download | nextcloud-server-99191167167dd6c98dc3ae9b0eca947526e7939f.tar.gz nextcloud-server-99191167167dd6c98dc3ae9b0eca947526e7939f.zip |
Merge pull request #31499 from nextcloud/bugfix/empty-secret
Add fallback routines for empty secret cases
Diffstat (limited to 'tests/lib/Authentication')
-rw-r--r-- | tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php index 1ef0aa80817..ad0a13937ae 100644 --- a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php +++ b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php @@ -296,9 +296,12 @@ class PublicKeyTokenProviderTest extends TestCase { } public function testInvalidateToken() { - $this->mapper->expects($this->once()) + $this->mapper->expects($this->at(0)) ->method('invalidate') ->with(hash('sha512', 'token7'.'1f4h9s')); + $this->mapper->expects($this->at(1)) + ->method('invalidate') + ->with(hash('sha512', 'token7')); $this->tokenProvider->invalidateToken('token7'); } @@ -429,13 +432,22 @@ class PublicKeyTokenProviderTest extends TestCase { public function testGetInvalidToken() { $this->expectException(InvalidTokenException::class); - $this->mapper->method('getToken') + $this->mapper->expects($this->at(0)) + ->method('getToken') ->with( - $this->callback(function (string $token) { + $this->callback(function (string $token): bool { return hash('sha512', 'unhashedToken'.'1f4h9s') === $token; }) )->willThrowException(new DoesNotExistException('nope')); + $this->mapper->expects($this->at(1)) + ->method('getToken') + ->with( + $this->callback(function (string $token): bool { + return hash('sha512', 'unhashedToken') === $token; + }) + )->willThrowException(new DoesNotExistException('nope')); + $this->tokenProvider->getToken('unhashedToken'); } |