diff options
author | Carl Schwan <carl@carlschwan.eu> | 2022-03-10 14:19:48 +0100 |
---|---|---|
committer | Carl Schwan <carl@carlschwan.eu> | 2022-03-10 14:19:48 +0100 |
commit | 01e2a26749da63e3e06c36d9151570c5beda78d2 (patch) | |
tree | 7b73285a123cac2cc0a37a97bd82bf1b0d0fca97 /tests | |
parent | a6796b424784561f4ab76d04324985f1f2f6a75f (diff) | |
download | nextcloud-server-01e2a26749da63e3e06c36d9151570c5beda78d2.tar.gz nextcloud-server-01e2a26749da63e3e06c36d9151570c5beda78d2.zip |
Fix unit tests
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'tests')
-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 062d1840a5f..524ace1ebf3 100644 --- a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php +++ b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php @@ -220,9 +220,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'); } @@ -355,13 +358,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'); } |