aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2020-10-12 17:14:25 +0200
committerMorris Jobke <hey@morrisjobke.de>2020-10-12 22:07:04 +0200
commit49ff48fcd3f07c229a0439748cb1469e5d11c504 (patch)
treeb6fb0e531e0b36920700124040056b92882263ae /tests
parentdeb499d34e7e4760db22d250b4cb1449e981d98c (diff)
downloadnextcloud-server-49ff48fcd3f07c229a0439748cb1469e5d11c504.tar.gz
nextcloud-server-49ff48fcd3f07c229a0439748cb1469e5d11c504.zip
Use PSR logger in authentication
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Authentication/Listeners/RemoteWipeActivityListenerTest.php6
-rw-r--r--tests/lib/Authentication/Listeners/RemoteWipeEmailListenerTest.php10
-rw-r--r--tests/lib/Authentication/Listeners/UserDeletedTokenCleanupListenerTest.php13
-rw-r--r--tests/lib/Authentication/Login/LoggedInCheckCommandTest.php6
-rw-r--r--tests/lib/Authentication/Login/UserDisabledCheckCommandTest.php6
-rw-r--r--tests/lib/Authentication/LoginCredentials/StoreTest.php6
-rw-r--r--tests/lib/Authentication/Token/DefaultTokenProviderTest.php6
-rw-r--r--tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php6
-rw-r--r--tests/lib/Authentication/Token/RemoteWipeTest.php6
-rw-r--r--tests/lib/Authentication/TwoFactorAuth/ManagerTest.php6
10 files changed, 35 insertions, 36 deletions
diff --git a/tests/lib/Authentication/Listeners/RemoteWipeActivityListenerTest.php b/tests/lib/Authentication/Listeners/RemoteWipeActivityListenerTest.php
index 05d38380026..6409ff2dc35 100644
--- a/tests/lib/Authentication/Listeners/RemoteWipeActivityListenerTest.php
+++ b/tests/lib/Authentication/Listeners/RemoteWipeActivityListenerTest.php
@@ -33,8 +33,8 @@ use OC\Authentication\Token\IToken;
use OCP\Activity\IManager as IActivityManager;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;
-use OCP\ILogger;
use PHPUnit\Framework\MockObject\MockObject;
+use Psr\Log\LoggerInterface;
use Test\TestCase;
class RemoteWipeActivityListenerTests extends TestCase {
@@ -42,7 +42,7 @@ class RemoteWipeActivityListenerTests extends TestCase {
/** @var IActivityManager|MockObject */
private $activityManager;
- /** @var ILogger|MockObject */
+ /** @var LoggerInterface|MockObject */
private $logger;
/** @var IEventListener */
@@ -52,7 +52,7 @@ class RemoteWipeActivityListenerTests extends TestCase {
parent::setUp();
$this->activityManager = $this->createMock(IActivityManager::class);
- $this->logger = $this->createMock(ILogger::class);
+ $this->logger = $this->createMock(LoggerInterface::class);
$this->listener = new RemoteWipeActivityListener(
$this->activityManager,
diff --git a/tests/lib/Authentication/Listeners/RemoteWipeEmailListenerTest.php b/tests/lib/Authentication/Listeners/RemoteWipeEmailListenerTest.php
index 9d2319fb9cc..932097d875f 100644
--- a/tests/lib/Authentication/Listeners/RemoteWipeEmailListenerTest.php
+++ b/tests/lib/Authentication/Listeners/RemoteWipeEmailListenerTest.php
@@ -33,13 +33,13 @@ use OC\Authentication\Token\IToken;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;
use OCP\IL10N;
-use OCP\ILogger;
use OCP\IUser;
use OCP\IUserManager;
use OCP\L10N\IFactory;
use OCP\Mail\IMailer;
use OCP\Mail\IMessage;
use PHPUnit\Framework\MockObject\MockObject;
+use Psr\Log\LoggerInterface;
use Test\TestCase;
class RemoteWipeEmailListenerTest extends TestCase {
@@ -56,7 +56,7 @@ class RemoteWipeEmailListenerTest extends TestCase {
/** @var IL10N|MockObject */
private $l10n;
- /** @var ILogger|MockObject */
+ /** @var LoggerInterface|MockObject */
private $logger;
/** @var IEventListener */
@@ -69,7 +69,7 @@ class RemoteWipeEmailListenerTest extends TestCase {
$this->userManager = $this->createMock(IUserManager::class);
$this->l10nFactory = $this->createMock(IFactory::class);
$this->l10n = $this->createMock(IL10N::class);
- $this->logger = $this->createMock(ILogger::class);
+ $this->logger = $this->createMock(LoggerInterface::class);
$this->l10nFactory->method('get')->with('core')->willReturn($this->l10n);
$this->l10n->method('t')->willReturnArgument(0);
@@ -135,7 +135,7 @@ class RemoteWipeEmailListenerTest extends TestCase {
->method('send')
->willThrowException(new Exception());
$this->logger->expects($this->once())
- ->method('logException');
+ ->method('error');
$this->listener->handle($event);
}
@@ -210,7 +210,7 @@ class RemoteWipeEmailListenerTest extends TestCase {
->method('send')
->willThrowException(new Exception());
$this->logger->expects($this->once())
- ->method('logException');
+ ->method('error');
$this->listener->handle($event);
}
diff --git a/tests/lib/Authentication/Listeners/UserDeletedTokenCleanupListenerTest.php b/tests/lib/Authentication/Listeners/UserDeletedTokenCleanupListenerTest.php
index 672a044ce01..bf8405a4422 100644
--- a/tests/lib/Authentication/Listeners/UserDeletedTokenCleanupListenerTest.php
+++ b/tests/lib/Authentication/Listeners/UserDeletedTokenCleanupListenerTest.php
@@ -30,10 +30,10 @@ use OC\Authentication\Listeners\UserDeletedTokenCleanupListener;
use OC\Authentication\Token\IToken;
use OC\Authentication\Token\Manager;
use OCP\EventDispatcher\Event;
-use OCP\ILogger;
use OCP\IUser;
use OCP\User\Events\UserDeletedEvent;
use PHPUnit\Framework\MockObject\MockObject;
+use Psr\Log\LoggerInterface;
use Test\TestCase;
class UserDeletedTokenCleanupListenerTest extends TestCase {
@@ -42,7 +42,7 @@ class UserDeletedTokenCleanupListenerTest extends TestCase {
/** @var Manager|MockObject */
private $manager;
- /** @var ILogger|MockObject */
+ /** @var LoggerInterface|MockObject */
private $logger;
/** @var UserDeletedTokenCleanupListener */
@@ -52,7 +52,7 @@ class UserDeletedTokenCleanupListenerTest extends TestCase {
parent::setUp();
$this->manager = $this->createMock(Manager::class);
- $this->logger = $this->createMock(ILogger::class);
+ $this->logger = $this->createMock(LoggerInterface::class);
$this->listener = new UserDeletedTokenCleanupListener(
$this->manager,
@@ -63,7 +63,7 @@ class UserDeletedTokenCleanupListenerTest extends TestCase {
public function testHandleUnrelated(): void {
$event = new Event();
$this->manager->expects($this->never())->method('getTokenByUser');
- $this->logger->expects($this->never())->method('logException');
+ $this->logger->expects($this->never())->method('error');
$this->listener->handle($event);
}
@@ -78,8 +78,7 @@ class UserDeletedTokenCleanupListenerTest extends TestCase {
->with('user123')
->willThrowException($exception);
$this->logger->expects($this->once())
- ->method('logException')
- ->with($exception, $this->anything());
+ ->method('error');
$this->listener->handle($event);
}
@@ -110,7 +109,7 @@ class UserDeletedTokenCleanupListenerTest extends TestCase {
['user123', 3]
);
$this->logger->expects($this->never())
- ->method('logException');
+ ->method('error');
$this->listener->handle($event);
}
diff --git a/tests/lib/Authentication/Login/LoggedInCheckCommandTest.php b/tests/lib/Authentication/Login/LoggedInCheckCommandTest.php
index 18f4a4938e8..4762c601bb8 100644
--- a/tests/lib/Authentication/Login/LoggedInCheckCommandTest.php
+++ b/tests/lib/Authentication/Login/LoggedInCheckCommandTest.php
@@ -28,12 +28,12 @@ namespace lib\Authentication\Login;
use OC\Authentication\Login\LoggedInCheckCommand;
use OC\Core\Controller\LoginController;
use OCP\EventDispatcher\IEventDispatcher;
-use OCP\ILogger;
use PHPUnit\Framework\MockObject\MockObject;
+use Psr\Log\LoggerInterface;
class LoggedInCheckCommandTest extends ALoginCommandTest {
- /** @var ILogger|MockObject */
+ /** @var LoggerInterface|MockObject */
private $logger;
/** @var IEventDispatcher|MockObject */
@@ -42,7 +42,7 @@ class LoggedInCheckCommandTest extends ALoginCommandTest {
protected function setUp(): void {
parent::setUp();
- $this->logger = $this->createMock(ILogger::class);
+ $this->logger = $this->createMock(LoggerInterface::class);
$this->dispatcher = $this->createMock(IEventDispatcher::class);
$this->cmd = new LoggedInCheckCommand(
diff --git a/tests/lib/Authentication/Login/UserDisabledCheckCommandTest.php b/tests/lib/Authentication/Login/UserDisabledCheckCommandTest.php
index e6f619aac0f..8c15ebe6c8f 100644
--- a/tests/lib/Authentication/Login/UserDisabledCheckCommandTest.php
+++ b/tests/lib/Authentication/Login/UserDisabledCheckCommandTest.php
@@ -27,23 +27,23 @@ namespace lib\Authentication\Login;
use OC\Authentication\Login\UserDisabledCheckCommand;
use OC\Core\Controller\LoginController;
-use OCP\ILogger;
use OCP\IUserManager;
use PHPUnit\Framework\MockObject\MockObject;
+use Psr\Log\LoggerInterface;
class UserDisabledCheckCommandTest extends ALoginCommandTest {
/** @var IUserManager|MockObject */
private $userManager;
- /** @var ILogger|MockObject */
+ /** @var LoggerInterface|MockObject */
private $logger;
protected function setUp(): void {
parent::setUp();
$this->userManager = $this->createMock(IUserManager::class);
- $this->logger = $this->createMock(ILogger::class);
+ $this->logger = $this->createMock(LoggerInterface::class);
$this->cmd = new UserDisabledCheckCommand(
$this->userManager,
diff --git a/tests/lib/Authentication/LoginCredentials/StoreTest.php b/tests/lib/Authentication/LoginCredentials/StoreTest.php
index ad8a074660c..797dbc08da9 100644
--- a/tests/lib/Authentication/LoginCredentials/StoreTest.php
+++ b/tests/lib/Authentication/LoginCredentials/StoreTest.php
@@ -31,9 +31,9 @@ use OC\Authentication\LoginCredentials\Store;
use OC\Authentication\Token\IProvider;
use OC\Authentication\Token\IToken;
use OCP\Authentication\Exceptions\CredentialsUnavailableException;
-use OCP\ILogger;
use OCP\ISession;
use OCP\Session\Exceptions\SessionNotAvailableException;
+use Psr\Log\LoggerInterface;
use Test\TestCase;
use function json_encode;
@@ -45,7 +45,7 @@ class StoreTest extends TestCase {
/** @var IProvider|\PHPUnit\Framework\MockObject\MockObject */
private $tokenProvider;
- /** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
private $logger;
/** @var Store */
@@ -56,7 +56,7 @@ class StoreTest extends TestCase {
$this->session = $this->createMock(ISession::class);
$this->tokenProvider = $this->createMock(IProvider::class);
- $this->logger = $this->createMock(ILogger::class);
+ $this->logger = $this->createMock(LoggerInterface::class);
$this->store = new Store($this->session, $this->logger, $this->tokenProvider);
}
diff --git a/tests/lib/Authentication/Token/DefaultTokenProviderTest.php b/tests/lib/Authentication/Token/DefaultTokenProviderTest.php
index 00b7f0dee03..7a8915a7c14 100644
--- a/tests/lib/Authentication/Token/DefaultTokenProviderTest.php
+++ b/tests/lib/Authentication/Token/DefaultTokenProviderTest.php
@@ -32,8 +32,8 @@ use OC\Authentication\Token\PublicKeyToken;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\IConfig;
-use OCP\ILogger;
use OCP\Security\ICrypto;
+use Psr\Log\LoggerInterface;
use Test\TestCase;
class DefaultTokenProviderTest extends TestCase {
@@ -46,7 +46,7 @@ class DefaultTokenProviderTest extends TestCase {
private $crypto;
/** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
private $config;
- /** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
private $logger;
/** @var ITimeFactory|\PHPUnit\Framework\MockObject\MockObject */
private $timeFactory;
@@ -59,7 +59,7 @@ class DefaultTokenProviderTest extends TestCase {
$this->mapper = $this->createMock(DefaultTokenMapper::class);
$this->crypto = $this->createMock(ICrypto::class);
$this->config = $this->createMock(IConfig::class);
- $this->logger = $this->createMock(ILogger::class);
+ $this->logger = $this->createMock(LoggerInterface::class);
$this->timeFactory = $this->createMock(ITimeFactory::class);
$this->time = 1313131;
$this->timeFactory->expects($this->any())
diff --git a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
index a815025a509..04e0fdb527e 100644
--- a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
+++ b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
@@ -33,8 +33,8 @@ use OC\Authentication\Token\PublicKeyTokenProvider;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\IConfig;
-use OCP\ILogger;
use OCP\Security\ICrypto;
+use Psr\Log\LoggerInterface;
use Test\TestCase;
class PublicKeyTokenProviderTest extends TestCase {
@@ -47,7 +47,7 @@ class PublicKeyTokenProviderTest extends TestCase {
private $crypto;
/** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
private $config;
- /** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
private $logger;
/** @var ITimeFactory|\PHPUnit\Framework\MockObject\MockObject */
private $timeFactory;
@@ -67,7 +67,7 @@ class PublicKeyTokenProviderTest extends TestCase {
['secret', '', '1f4h9s'],
['openssl', [], []],
]);
- $this->logger = $this->createMock(ILogger::class);
+ $this->logger = $this->createMock(LoggerInterface::class);
$this->timeFactory = $this->createMock(ITimeFactory::class);
$this->time = 1313131;
$this->timeFactory->method('getTime')
diff --git a/tests/lib/Authentication/Token/RemoteWipeTest.php b/tests/lib/Authentication/Token/RemoteWipeTest.php
index 1338931ac72..e2506562dd4 100644
--- a/tests/lib/Authentication/Token/RemoteWipeTest.php
+++ b/tests/lib/Authentication/Token/RemoteWipeTest.php
@@ -34,9 +34,9 @@ use OC\Authentication\Token\IToken;
use OC\Authentication\Token\IWipeableToken;
use OC\Authentication\Token\RemoteWipe;
use OCP\EventDispatcher\IEventDispatcher;
-use OCP\ILogger;
use OCP\IUser;
use PHPUnit\Framework\MockObject\MockObject;
+use Psr\Log\LoggerInterface;
use Test\TestCase;
class RemoteWipeTest extends TestCase {
@@ -47,7 +47,7 @@ class RemoteWipeTest extends TestCase {
/** @var IEventDispatcher|MockObject */
private $eventDispatcher;
- /** @var ILogger|MockObject */
+ /** @var LoggerInterface|MockObject */
private $logger;
/** @var RemoteWipe */
@@ -58,7 +58,7 @@ class RemoteWipeTest extends TestCase {
$this->tokenProvider = $this->createMock(IProvider::class);
$this->eventDispatcher = $this->createMock(IEventDispatcher::class);
- $this->logger = $this->createMock(ILogger::class);
+ $this->logger = $this->createMock(LoggerInterface::class);
$this->remoteWipe = new RemoteWipe(
$this->tokenProvider,
diff --git a/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php b/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php
index 051f2936ad7..c93b625f61a 100644
--- a/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php
+++ b/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php
@@ -34,10 +34,10 @@ use OCP\Authentication\TwoFactorAuth\IActivatableAtLogin;
use OCP\Authentication\TwoFactorAuth\IProvider;
use OCP\Authentication\TwoFactorAuth\IRegistry;
use OCP\IConfig;
-use OCP\ILogger;
use OCP\ISession;
use OCP\IUser;
use PHPUnit\Framework\MockObject\MockObject;
+use Psr\Log\LoggerInterface;
use function reset;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Test\TestCase;
@@ -68,7 +68,7 @@ class ManagerTest extends TestCase {
/** @var IManager|MockObject */
private $activityManager;
- /** @var ILogger|MockObject */
+ /** @var LoggerInterface|MockObject */
private $logger;
/** @var IProvider|MockObject */
@@ -96,7 +96,7 @@ class ManagerTest extends TestCase {
$this->session = $this->createMock(ISession::class);
$this->config = $this->createMock(IConfig::class);
$this->activityManager = $this->createMock(IManager::class);
- $this->logger = $this->createMock(ILogger::class);
+ $this->logger = $this->createMock(LoggerInterface::class);
$this->tokenProvider = $this->createMock(TokenProvider::class);
$this->timeFactory = $this->createMock(ITimeFactory::class);
$this->eventDispatcher = $this->createMock(EventDispatcherInterface::class);