diff options
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'); } |