diff options
Diffstat (limited to 'tests/Core')
-rw-r--r-- | tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php | 6 | ||||
-rw-r--r-- | tests/Core/Command/Encryption/DecryptAllTest.php | 34 | ||||
-rw-r--r-- | tests/Core/Command/Encryption/EnableTest.php | 42 | ||||
-rw-r--r-- | tests/Core/Command/Encryption/EncryptAllTest.php | 8 | ||||
-rw-r--r-- | tests/Core/Command/Encryption/SetDefaultModuleTest.php | 11 | ||||
-rw-r--r-- | tests/Core/Command/Log/FileTest.php | 14 | ||||
-rw-r--r-- | tests/Core/Command/Log/ManageTest.php | 37 | ||||
-rw-r--r-- | tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php | 44 | ||||
-rw-r--r-- | tests/Core/Command/Preview/RepairTest.php | 2 | ||||
-rw-r--r-- | tests/Core/Command/User/AuthTokens/DeleteTest.php | 170 | ||||
-rw-r--r-- | tests/Core/Controller/ClientFlowLoginControllerTest.php | 8 | ||||
-rw-r--r-- | tests/Core/Controller/LoginControllerTest.php | 6 |
12 files changed, 271 insertions, 111 deletions
diff --git a/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php b/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php index ecb3faaa25d..1b34d16a5db 100644 --- a/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php +++ b/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php @@ -159,9 +159,9 @@ class ChangeKeyStorageRootTest extends TestCase { ] )->setMethods(['prepareNewRoot', 'moveSystemKeys', 'moveUserKeys'])->getMock(); - $changeKeyStorageRoot->expects($this->at(0))->method('prepareNewRoot')->with('newRoot'); - $changeKeyStorageRoot->expects($this->at(1))->method('moveSystemKeys')->with('oldRoot', 'newRoot'); - $changeKeyStorageRoot->expects($this->at(2))->method('moveUserKeys')->with('oldRoot', 'newRoot', $this->outputInterface); + $changeKeyStorageRoot->expects($this->once())->method('prepareNewRoot')->with('newRoot'); + $changeKeyStorageRoot->expects($this->once())->method('moveSystemKeys')->with('oldRoot', 'newRoot'); + $changeKeyStorageRoot->expects($this->once())->method('moveUserKeys')->with('oldRoot', 'newRoot', $this->outputInterface); $this->invokePrivate($changeKeyStorageRoot, 'moveAllKeys', ['oldRoot', 'newRoot', $this->outputInterface]); } diff --git a/tests/Core/Command/Encryption/DecryptAllTest.php b/tests/Core/Command/Encryption/DecryptAllTest.php index c78500fd9d8..c60e5aff99c 100644 --- a/tests/Core/Command/Encryption/DecryptAllTest.php +++ b/tests/Core/Command/Encryption/DecryptAllTest.php @@ -86,17 +86,16 @@ class DecryptAllTest extends TestCase { public function testMaintenanceAndTrashbin() { // on construct we enable single-user-mode and disable the trash bin - $this->config->expects($this->at(1)) + // on destruct we disable single-user-mode again and enable the trash bin + $this->config->expects($this->exactly(2)) ->method('setSystemValue') - ->with('maintenance', true); + ->withConsecutive( + ['maintenance', true], + ['maintenance', false], + ); $this->appManager->expects($this->once()) ->method('disableApp') ->with('files_trashbin'); - - // on destruct wi disable single-user-mode again and enable the trash bin - $this->config->expects($this->at(2)) - ->method('setSystemValue') - ->with('maintenance', false); $this->appManager->expects($this->once()) ->method('enableApp') ->with('files_trashbin'); @@ -142,9 +141,12 @@ class DecryptAllTest extends TestCase { ->willReturn('user1'); if ($encryptionEnabled) { - $this->config->expects($this->at(1)) + $this->config->expects($this->exactly(2)) ->method('setAppValue') - ->with('core', 'encryption_enabled', 'no'); + ->withConsecutive( + ['core', 'encryption_enabled', 'no'], + ['core', 'encryption_enabled', 'yes'], + ); $this->questionHelper->expects($this->once()) ->method('ask') ->willReturn($continue); @@ -154,9 +156,6 @@ class DecryptAllTest extends TestCase { ->with($this->consoleInput, $this->consoleOutput, 'user1'); } else { $this->decryptAll->expects($this->never())->method('decryptAll'); - $this->config->expects($this->at(2)) - ->method('setAppValue') - ->with('core', 'encryption_enabled', 'yes'); } } else { $this->config->expects($this->never())->method('setAppValue'); @@ -188,14 +187,13 @@ class DecryptAllTest extends TestCase { $this->questionHelper ); - $this->config->expects($this->at(1)) - ->method('setAppValue') - ->with('core', 'encryption_enabled', 'no'); - // make sure that we enable encryption again after a exception was thrown - $this->config->expects($this->at(4)) + $this->config->expects($this->exactly(2)) ->method('setAppValue') - ->with('core', 'encryption_enabled', 'yes'); + ->withConsecutive( + ['core', 'encryption_enabled', 'no'], + ['core', 'encryption_enabled', 'yes'], + ); $this->encryptionManager->expects($this->once()) ->method('isEnabled') diff --git a/tests/Core/Command/Encryption/EnableTest.php b/tests/Core/Command/Encryption/EnableTest.php index c1656054ecd..9c7127085ca 100644 --- a/tests/Core/Command/Encryption/EnableTest.php +++ b/tests/Core/Command/Encryption/EnableTest.php @@ -80,42 +80,40 @@ class EnableTest extends TestCase { * @param string $expectedDefaultModuleString */ public function testEnable($oldStatus, $defaultModule, $availableModules, $isUpdating, $expectedString, $expectedDefaultModuleString) { - $invokeCount = 0; - $this->config->expects($this->at($invokeCount)) - ->method('getAppValue') - ->with('core', 'encryption_enabled', $this->anything()) - ->willReturn($oldStatus); - $invokeCount++; - if ($isUpdating) { $this->config->expects($this->once()) ->method('setAppValue') ->with('core', 'encryption_enabled', 'yes'); - $invokeCount++; } $this->manager->expects($this->atLeastOnce()) ->method('getEncryptionModules') ->willReturn($availableModules); - if (!empty($availableModules)) { - $this->config->expects($this->at($invokeCount)) + if (empty($availableModules)) { + $this->config->expects($this->once()) ->method('getAppValue') - ->with('core', 'default_encryption_module', $this->anything()) - ->willReturn($defaultModule); + ->with('core', 'encryption_enabled', $this->anything()) + ->willReturn($oldStatus); + } else { + $this->config->expects($this->exactly(2)) + ->method('getAppValue') + ->withConsecutive( + ['core', 'encryption_enabled', $this->anything()], + ['core', 'default_encryption_module', $this->anything()], + )->willReturnOnConsecutiveCalls( + $oldStatus, + $defaultModule, + ); } - $this->consoleOutput->expects($this->at(0)) - ->method('writeln') - ->with($this->stringContains($expectedString)); - - $this->consoleOutput->expects($this->at(1)) - ->method('writeln') - ->with(''); - - $this->consoleOutput->expects($this->at(2)) + $this->consoleOutput->expects($this->exactly(3)) ->method('writeln') - ->with($this->stringContains($expectedDefaultModuleString)); + ->withConsecutive( + [$this->stringContains($expectedString)], + [''], + [$this->stringContains($expectedDefaultModuleString)], + ); self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); } diff --git a/tests/Core/Command/Encryption/EncryptAllTest.php b/tests/Core/Command/Encryption/EncryptAllTest.php index 1190a98843f..4ba9e32fa16 100644 --- a/tests/Core/Command/Encryption/EncryptAllTest.php +++ b/tests/Core/Command/Encryption/EncryptAllTest.php @@ -88,8 +88,12 @@ class EncryptAllTest extends TestCase { // enable single user mode to avoid that other user login during encryption // destructor should disable the single user mode again $this->config->expects($this->once())->method('getSystemValueBool')->with('maintenance', false)->willReturn(false); - $this->config->expects($this->at(1))->method('setSystemValue')->with('maintenance', true); - $this->config->expects($this->at(2))->method('setSystemValue')->with('maintenance', false); + $this->config->expects($this->exactly(2)) + ->method('setSystemValue') + ->withConsecutive( + ['maintenance', true], + ['maintenance', false], + ); $instance = new EncryptAll($this->encryptionManager, $this->appManager, $this->config, $this->questionHelper); $this->invokePrivate($instance, 'forceMaintenanceAndTrashbin'); diff --git a/tests/Core/Command/Encryption/SetDefaultModuleTest.php b/tests/Core/Command/Encryption/SetDefaultModuleTest.php index 015964e1357..4a39fc0aefb 100644 --- a/tests/Core/Command/Encryption/SetDefaultModuleTest.php +++ b/tests/Core/Command/Encryption/SetDefaultModuleTest.php @@ -127,13 +127,12 @@ class SetDefaultModuleTest extends TestCase { ->with('maintenance', false) ->willReturn(true); - $this->consoleOutput->expects($this->at(0)) + $this->consoleOutput->expects($this->exactly(2)) ->method('writeln') - ->with($this->stringContains('Maintenance mode must be disabled when setting default module,')); - - $this->consoleOutput->expects($this->at(1)) - ->method('writeln') - ->with($this->stringContains('in order to load the relevant encryption modules correctly.')); + ->withConsecutive( + [$this->stringContains('Maintenance mode must be disabled when setting default module,')], + [$this->stringContains('in order to load the relevant encryption modules correctly.')], + ); self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); } diff --git a/tests/Core/Command/Log/FileTest.php b/tests/Core/Command/Log/FileTest.php index 103888de287..3e792dab24f 100644 --- a/tests/Core/Command/Log/FileTest.php +++ b/tests/Core/Command/Log/FileTest.php @@ -110,15 +110,13 @@ class FileTest extends TestCase { ['log_rotate_size', 100 * 1024 * 1024, 5 * 1024 * 1024], ]); - $this->consoleOutput->expects($this->at(0)) + $this->consoleOutput->expects($this->exactly(3)) ->method('writeln') - ->with('Log backend file: disabled'); - $this->consoleOutput->expects($this->at(1)) - ->method('writeln') - ->with('Log file: /var/log/nextcloud.log'); - $this->consoleOutput->expects($this->at(2)) - ->method('writeln') - ->with('Rotate at: 5 MB'); + ->withConsecutive( + ['Log backend file: disabled'], + ['Log file: /var/log/nextcloud.log'], + ['Rotate at: 5 MB'], + ); self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); } diff --git a/tests/Core/Command/Log/ManageTest.php b/tests/Core/Command/Log/ManageTest.php index 6683291a9b8..c6c0669e0b4 100644 --- a/tests/Core/Command/Log/ManageTest.php +++ b/tests/Core/Command/Log/ManageTest.php @@ -156,28 +156,25 @@ class ManageTest extends TestCase { } public function testGetConfiguration() { - $this->config->expects($this->at(0)) + $this->config->expects($this->exactly(3)) ->method('getSystemValue') - ->with('log_type', 'file') - ->willReturn('log_type_value'); - $this->config->expects($this->at(1)) - ->method('getSystemValue') - ->with('loglevel', 2) - ->willReturn(0); - $this->config->expects($this->at(2)) - ->method('getSystemValue') - ->with('logtimezone', 'UTC') - ->willReturn('logtimezone_value'); - - $this->consoleOutput->expects($this->at(0)) - ->method('writeln') - ->with('Enabled logging backend: log_type_value'); - $this->consoleOutput->expects($this->at(1)) - ->method('writeln') - ->with('Log level: Debug (0)'); - $this->consoleOutput->expects($this->at(2)) + ->withConsecutive( + ['log_type', 'file'], + ['loglevel', 2], + ['logtimezone', 'UTC'], + )->willReturnOnConsecutiveCalls( + 'log_type_value', + 0, + 'logtimezone_value' + ); + + $this->consoleOutput->expects($this->exactly(3)) ->method('writeln') - ->with('Log timezone: logtimezone_value'); + ->withConsecutive( + ['Enabled logging backend: log_type_value'], + ['Log level: Debug (0)'], + ['Log timezone: logtimezone_value'], + ); self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); } diff --git a/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php b/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php index bd08a5348a2..0c966ca576c 100644 --- a/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php +++ b/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php @@ -78,12 +78,12 @@ class UpdateDBTest extends TestCase { $this->loader->expects($this->never()) ->method('updateFilecache'); - $this->consoleOutput->expects($this->at(0)) + $this->consoleOutput->expects($this->exactly(2)) ->method('writeln') - ->with('Added 0 new mimetypes'); - $this->consoleOutput->expects($this->at(1)) - ->method('writeln') - ->with('Updated 0 filecache rows'); + ->withConsecutive( + ['Added 0 new mimetypes'], + ['Updated 0 filecache rows'], + ); self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); } @@ -117,19 +117,14 @@ class UpdateDBTest extends TestCase { ->with('new', 2) ->willReturn(3); - $this->consoleOutput->expects($this->at(0)) - ->method('writeln') - ->with('Added mimetype "testing/newmimetype" to database'); - $this->consoleOutput->expects($this->at(1)) - ->method('writeln') - ->with('Updated 3 filecache rows for mimetype "testing/newmimetype"'); - - $this->consoleOutput->expects($this->at(2)) + $this->consoleOutput->expects($this->exactly(4)) ->method('writeln') - ->with('Added 1 new mimetypes'); - $this->consoleOutput->expects($this->at(3)) - ->method('writeln') - ->with('Updated 3 filecache rows'); + ->withConsecutive( + ['Added mimetype "testing/newmimetype" to database'], + ['Updated 3 filecache rows for mimetype "testing/newmimetype"'], + ['Added 1 new mimetypes'], + ['Updated 3 filecache rows'], + ); self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); } @@ -172,16 +167,13 @@ class UpdateDBTest extends TestCase { ->with('ext', 1) ->willReturn(3); - $this->consoleOutput->expects($this->at(0)) - ->method('writeln') - ->with('Updated 3 filecache rows for mimetype "testing/existingmimetype"'); - - $this->consoleOutput->expects($this->at(1)) - ->method('writeln') - ->with('Added 0 new mimetypes'); - $this->consoleOutput->expects($this->at(2)) + $this->consoleOutput->expects($this->exactly(3)) ->method('writeln') - ->with('Updated 3 filecache rows'); + ->withConsecutive( + ['Updated 3 filecache rows for mimetype "testing/existingmimetype"'], + ['Added 0 new mimetypes'], + ['Updated 3 filecache rows'], + ); self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); } diff --git a/tests/Core/Command/Preview/RepairTest.php b/tests/Core/Command/Preview/RepairTest.php index 090e9cc0bd0..fd4af615340 100644 --- a/tests/Core/Command/Preview/RepairTest.php +++ b/tests/Core/Command/Preview/RepairTest.php @@ -142,7 +142,7 @@ class RepairTest extends TestCase { $previewFolder->expects($this->once()) ->method('getDirectoryListing') ->willReturn($directories); - $this->rootFolder->expects($this->at(0)) + $this->rootFolder->expects($this->once()) ->method('get') ->with("appdata_/preview") ->willReturn($previewFolder); diff --git a/tests/Core/Command/User/AuthTokens/DeleteTest.php b/tests/Core/Command/User/AuthTokens/DeleteTest.php new file mode 100644 index 00000000000..528d4c6869b --- /dev/null +++ b/tests/Core/Command/User/AuthTokens/DeleteTest.php @@ -0,0 +1,170 @@ +<?php +/** + * @copyright Copyright (c) 2023 Lucas Azevedo <lhs_azevedo@hotmail.com> + * + * @author Lucas Azevedo <lhs_azevedo@hotmail.com> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +namespace Tests\Core\Command\User\AuthTokens; + +use OC\Core\Command\User\AuthTokens\Delete; +use OC\Authentication\Token\IProvider; +use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Exception\RuntimeException; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Test\TestCase; + +class DeleteTest extends TestCase { + /** @var \PHPUnit\Framework\MockObject\MockObject */ + protected $tokenProvider; + /** @var \PHPUnit\Framework\MockObject\MockObject */ + protected $consoleInput; + /** @var \PHPUnit\Framework\MockObject\MockObject */ + protected $consoleOutput; + + /** @var \Symfony\Component\Console\Command\Command */ + protected $command; + + protected function setUp(): void { + parent::setUp(); + + $tokenProvider = $this->tokenProvider = $this->getMockBuilder(IProvider::class) + ->disableOriginalConstructor() + ->getMock(); + $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock(); + $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock(); + + /** @var \OC\Authentication\Token\IProvider $tokenProvider */ + $this->command = new Delete($tokenProvider); + } + + public function testDeleteTokenById() { + $this->consoleInput->expects($this->exactly(2)) + ->method('getArgument') + ->withConsecutive(['uid'], ['id']) + ->willReturnOnConsecutiveCalls('user', 42); + + $this->consoleInput->expects($this->once()) + ->method('getOption') + ->with('last-used-before') + ->willReturn(null); + + $this->tokenProvider->expects($this->once()) + ->method('invalidateTokenById') + ->with('user', 42); + + $result = self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); + $this->assertSame(Command::SUCCESS, $result); + } + + public function testDeleteTokenByIdRequiresTokenId() { + $this->consoleInput->expects($this->exactly(2)) + ->method('getArgument') + ->withConsecutive(['uid'], ['id']) + ->willReturnOnConsecutiveCalls('user', null); + + $this->consoleInput->expects($this->once()) + ->method('getOption') + ->with('last-used-before') + ->willReturn(null); + + $this->expectException(RuntimeException::class); + + $this->tokenProvider->expects($this->never())->method('invalidateTokenById'); + + $result = self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); + $this->assertSame(Command::FAILURE, $result); + } + + public function testDeleteTokensLastUsedBefore() { + $this->consoleInput->expects($this->exactly(2)) + ->method('getArgument') + ->withConsecutive(['uid'], ['id']) + ->willReturnOnConsecutiveCalls('user', null); + + $this->consoleInput->expects($this->once()) + ->method('getOption') + ->with('last-used-before') + ->willReturn('946684800'); + + $this->tokenProvider->expects($this->once()) + ->method('invalidateLastUsedBefore') + ->with('user', 946684800); + + $result = self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); + $this->assertSame(Command::SUCCESS, $result); + } + + public function testLastUsedBeforeAcceptsIso8601Expanded() { + $this->consoleInput->expects($this->exactly(2)) + ->method('getArgument') + ->withConsecutive(['uid'], ['id']) + ->willReturnOnConsecutiveCalls('user', null); + + $this->consoleInput->expects($this->once()) + ->method('getOption') + ->with('last-used-before') + ->willReturn('2000-01-01T00:00:00Z'); + + $this->tokenProvider->expects($this->once()) + ->method('invalidateLastUsedBefore') + ->with('user', 946684800); + + $result = self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); + $this->assertSame(Command::SUCCESS, $result); + } + + public function testLastUsedBeforeAcceptsYmd() { + $this->consoleInput->expects($this->exactly(2)) + ->method('getArgument') + ->withConsecutive(['uid'], ['id']) + ->willReturnOnConsecutiveCalls('user', null); + + $this->consoleInput->expects($this->once()) + ->method('getOption') + ->with('last-used-before') + ->willReturn('2000-01-01'); + + $this->tokenProvider->expects($this->once()) + ->method('invalidateLastUsedBefore') + ->with('user', 946684800); + + $result = self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); + $this->assertSame(Command::SUCCESS, $result); + } + + public function testIdAndLastUsedBeforeAreMutuallyExclusive() { + $this->consoleInput->expects($this->exactly(2)) + ->method('getArgument') + ->withConsecutive(['uid'], ['id']) + ->willReturnOnConsecutiveCalls('user', 42); + + $this->consoleInput->expects($this->once()) + ->method('getOption') + ->with('last-used-before') + ->willReturn('946684800'); + + $this->expectException(RuntimeException::class); + + $this->tokenProvider->expects($this->never())->method('invalidateLastUsedBefore'); + + $result = self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); + $this->assertSame(Command::SUCCESS, $result); + } +} diff --git a/tests/Core/Controller/ClientFlowLoginControllerTest.php b/tests/Core/Controller/ClientFlowLoginControllerTest.php index dfd3e629dcd..1a3d6ba109a 100644 --- a/tests/Core/Controller/ClientFlowLoginControllerTest.php +++ b/tests/Core/Controller/ClientFlowLoginControllerTest.php @@ -31,6 +31,7 @@ use OCA\OAuth2\Db\Client; use OCA\OAuth2\Db\ClientMapper; use OCP\AppFramework\Http; use OCP\AppFramework\Http\StandaloneTemplateResponse; +use OCP\AppFramework\Utility\ITimeFactory; use OCP\Defaults; use OCP\EventDispatcher\IEventDispatcher; use OCP\IL10N; @@ -69,7 +70,8 @@ class ClientFlowLoginControllerTest extends TestCase { private $crypto; /** @var IEventDispatcher|\PHPUnit\Framework\MockObject\MockObject */ private $eventDispatcher; - + /** @var ITimeFactory|\PHPUnit\Framework\MockObject\MockObject */ + private $timeFactory; /** @var ClientFlowLoginController */ private $clientFlowLoginController; @@ -95,6 +97,7 @@ class ClientFlowLoginControllerTest extends TestCase { $this->accessTokenMapper = $this->createMock(AccessTokenMapper::class); $this->crypto = $this->createMock(ICrypto::class); $this->eventDispatcher = $this->createMock(IEventDispatcher::class); + $this->timeFactory = $this->createMock(ITimeFactory::class); $this->clientFlowLoginController = new ClientFlowLoginController( 'core', @@ -109,7 +112,8 @@ class ClientFlowLoginControllerTest extends TestCase { $this->clientMapper, $this->accessTokenMapper, $this->crypto, - $this->eventDispatcher + $this->eventDispatcher, + $this->timeFactory ); } diff --git a/tests/Core/Controller/LoginControllerTest.php b/tests/Core/Controller/LoginControllerTest.php index 6044440bdaf..333baf0aa86 100644 --- a/tests/Core/Controller/LoginControllerTest.php +++ b/tests/Core/Controller/LoginControllerTest.php @@ -29,7 +29,6 @@ use OC\Authentication\Login\LoginData; use OC\Authentication\Login\LoginResult; use OC\Authentication\TwoFactorAuth\Manager; use OC\Core\Controller\LoginController; -use OC\Security\Bruteforce\Throttler; use OC\User\Session; use OCP\AppFramework\Http\RedirectResponse; use OCP\AppFramework\Http\TemplateResponse; @@ -43,6 +42,7 @@ use OCP\IURLGenerator; use OCP\IUser; use OCP\IUserManager; use OCP\Notification\IManager; +use OCP\Security\Bruteforce\IThrottler; use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; @@ -74,7 +74,7 @@ class LoginControllerTest extends TestCase { /** @var Defaults|MockObject */ private $defaults; - /** @var Throttler|MockObject */ + /** @var IThrottler|MockObject */ private $throttler; /** @var IInitialStateService|MockObject */ @@ -99,7 +99,7 @@ class LoginControllerTest extends TestCase { $this->urlGenerator = $this->createMock(IURLGenerator::class); $this->twoFactorManager = $this->createMock(Manager::class); $this->defaults = $this->createMock(Defaults::class); - $this->throttler = $this->createMock(Throttler::class); + $this->throttler = $this->createMock(IThrottler::class); $this->initialStateService = $this->createMock(IInitialStateService::class); $this->webAuthnManager = $this->createMock(\OC\Authentication\WebAuthn\Manager::class); $this->notificationManager = $this->createMock(IManager::class); |