summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-03-10 14:19:48 +0100
committerVincent Petry (Rebase PR Action) <PVince81@users.noreply.github.com>2022-12-05 16:10:55 +0000
commit1d33d37bf21ccc51f21c056fac8a65f5d3276729 (patch)
treee1273855c0f39d2d592e5728a9c71377f76df6f6 /tests
parent0f7260de03b3fd5b1cf70cd79a1d6c77faeb56f5 (diff)
downloadnextcloud-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.php18
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');
}