diff options
author | Carl Schwan <carl@carlschwan.eu> | 2022-03-10 14:19:48 +0100 |
---|---|---|
committer | Vincent Petry (Rebase PR Action) <PVince81@users.noreply.github.com> | 2022-12-05 16:10:55 +0000 |
commit | 1d33d37bf21ccc51f21c056fac8a65f5d3276729 (patch) | |
tree | e1273855c0f39d2d592e5728a9c71377f76df6f6 /tests | |
parent | 0f7260de03b3fd5b1cf70cd79a1d6c77faeb56f5 (diff) | |
download | nextcloud-server-1d33d37bf21ccc51f21c056fac8a65f5d3276729.tar.gz nextcloud-server-1d33d37bf21ccc51f21c056fac8a65f5d3276729.zip |
Fix unit tests
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
(cherry picked from commit 01e2a26749da63e3e06c36d9151570c5beda78d2)
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 d9135d7e2c4..d6e8dba31be 100644 --- a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php +++ b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php @@ -310,9 +310,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'); } @@ -443,13 +446,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'); } |