aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php')
-rw-r--r--tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php17
1 files changed, 9 insertions, 8 deletions
diff --git a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
index dc6ec7c7f3e..c6c4ec4198f 100644
--- a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
+++ b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
@@ -23,6 +23,7 @@ use OCP\IConfig;
use OCP\IDBConnection;
use OCP\Security\ICrypto;
use OCP\Security\IHasher;
+use OCP\Server;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
use Test\TestCase;
@@ -53,8 +54,8 @@ class PublicKeyTokenProviderTest extends TestCase {
parent::setUp();
$this->mapper = $this->createMock(PublicKeyTokenMapper::class);
- $this->hasher = \OC::$server->get(IHasher::class);
- $this->crypto = \OC::$server->getCrypto();
+ $this->hasher = Server::get(IHasher::class);
+ $this->crypto = Server::get(ICrypto::class);
$this->config = $this->createMock(IConfig::class);
$this->config->method('getSystemValue')
->willReturnMap([
@@ -232,7 +233,7 @@ class PublicKeyTokenProviderTest extends TestCase {
public function testGetPasswordPasswordLessToken(): void {
- $this->expectException(\OC\Authentication\Exceptions\PasswordlessTokenException::class);
+ $this->expectException(PasswordlessTokenException::class);
$token = 'token1234';
$tk = new PublicKeyToken();
@@ -243,7 +244,7 @@ class PublicKeyTokenProviderTest extends TestCase {
public function testGetPasswordInvalidToken(): void {
- $this->expectException(\OC\Authentication\Exceptions\InvalidTokenException::class);
+ $this->expectException(InvalidTokenException::class);
$token = 'tokentokentokentokentoken';
$uid = 'user';
@@ -294,7 +295,7 @@ class PublicKeyTokenProviderTest extends TestCase {
public function testSetPasswordInvalidToken(): void {
- $this->expectException(\OC\Authentication\Exceptions\InvalidTokenException::class);
+ $this->expectException(InvalidTokenException::class);
$token = $this->createMock(IToken::class);
$tokenId = 'token123';
@@ -311,7 +312,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->mapper->expects($this->exactly(2))
->method('invalidate')
- ->willReturnCallback(function () use (&$calls) {
+ ->willReturnCallback(function () use (&$calls): void {
$expected = array_shift($calls);
$this->assertEquals($expected, func_get_args());
});
@@ -350,7 +351,7 @@ class PublicKeyTokenProviderTest extends TestCase {
];
$this->mapper->expects($this->exactly(4))
->method('invalidateOld')
- ->willReturnCallback(function () use (&$calls) {
+ ->willReturnCallback(function () use (&$calls): void {
$expected = array_shift($calls);
$this->assertEquals($expected, func_get_args());
});
@@ -469,7 +470,7 @@ class PublicKeyTokenProviderTest extends TestCase {
];
$this->mapper->expects($this->exactly(2))
->method('getToken')
- ->willReturnCallback(function (string $token) use (&$calls) {
+ ->willReturnCallback(function (string $token) use (&$calls): void {
$expected = array_shift($calls);
$this->assertEquals(hash('sha512', $expected), $token);
throw new DoesNotExistException('nope');