chore: run rector on tests with new rule

Signed-off-by: Robin Appelman <robin@icewind.nl>
pull/53459/head
Robin Appelman 4 months ago
parent 3cc34ac29d
commit 3561937816
No known key found for this signature in database
GPG Key ID: 42B69D8A64526EFB
  1. 4
      tests/Core/Command/User/AddTest.php
  2. 12
      tests/Core/Controller/AvatarControllerTest.php
  3. 2
      tests/Core/Controller/ChangePasswordControllerTest.php
  4. 2
      tests/Core/Controller/LostControllerTest.php
  5. 2
      tests/Core/Controller/TwoFactorChallengeControllerTest.php
  6. 2
      tests/lib/AppFramework/Http/DispatcherTest.php
  7. 2
      tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php
  8. 14
      tests/lib/Authentication/LoginCredentials/StoreTest.php
  9. 8
      tests/lib/BinaryFinderTest.php
  10. 6
      tests/lib/Cache/FileCacheTest.php
  11. 6
      tests/lib/Calendar/ResourcesRoomsUpdaterTest.php
  12. 8
      tests/lib/Contacts/ContactsMenu/Providers/LocalTimeProviderTest.php
  13. 2
      tests/lib/Files/Mount/MountPointTest.php
  14. 2
      tests/lib/Files/Node/FolderTest.php
  15. 4
      tests/lib/Files/Node/NodeTestCase.php
  16. 4
      tests/lib/Files/Storage/Wrapper/AvailabilityTest.php
  17. 8
      tests/lib/Files/ViewTest.php
  18. 15
      tests/lib/Group/MetaDataTest.php
  19. 20
      tests/lib/Http/Client/ClientTest.php
  20. 6
      tests/lib/IntegrityCheck/CheckerTest.php
  21. 8
      tests/lib/LoggerTest.php
  22. 9
      tests/lib/Repair/Owncloud/CleanPreviewsBackgroundJobTest.php
  23. 4
      tests/lib/Repair/Owncloud/CleanPreviewsTest.php
  24. 2
      tests/lib/RepairTest.php
  25. 4
      tests/lib/Template/ResourceLocatorTest.php
  26. 4
      tests/lib/Traits/MountProviderTrait.php
  27. 20
      tests/lib/User/SessionTest.php
  28. 8
      tests/lib/User/UserTest.php

@ -111,11 +111,11 @@ class AddTest extends TestCase {
->method('sendMail');
$this->consoleInput->method('getOption')
->will(static::returnValueMap([
->willReturnMap([
['generate-password', 'true'],
['email', $email],
['group', []],
]));
]);
$this->invokePrivate($this->addCommand, 'execute', [
$this->consoleInput,

@ -130,7 +130,7 @@ class AvatarControllerTest extends \Test\TestCase {
*/
public function testGetAvatarNoAvatar(): void {
$this->avatarManager->method('getAvatar')->willReturn($this->avatarMock);
$this->avatarMock->method('getFile')->will($this->throwException(new NotFoundException()));
$this->avatarMock->method('getFile')->willThrowException(new NotFoundException());
$response = $this->avatarController->getAvatar('userId', 32);
//Comment out until JS is fixed
@ -183,7 +183,7 @@ class AvatarControllerTest extends \Test\TestCase {
$this->avatarManager
->method('getAvatar')
->with('userDoesNotExist')
->will($this->throwException(new \Exception('user does not exist')));
->willThrowException(new \Exception('user does not exist'));
$response = $this->avatarController->getAvatar('userDoesNotExist', 32);
@ -287,7 +287,7 @@ class AvatarControllerTest extends \Test\TestCase {
* Test what happens if the removing of the avatar fails
*/
public function testDeleteAvatarException(): void {
$this->avatarMock->method('remove')->will($this->throwException(new \Exception('foo')));
$this->avatarMock->method('remove')->willThrowException(new \Exception('foo'));
$this->avatarManager->method('getAvatar')->willReturn($this->avatarMock);
$this->logger->expects($this->once())
@ -469,7 +469,7 @@ class AvatarControllerTest extends \Test\TestCase {
public function testPostAvatarException(): void {
$this->cache->expects($this->once())
->method('set')
->will($this->throwException(new \Exception('foo')));
->willThrowException(new \Exception('foo'));
$file = $this->getMockBuilder('OCP\Files\File')
->disableOriginalConstructor()->getMock();
$file->expects($this->once())
@ -514,7 +514,7 @@ class AvatarControllerTest extends \Test\TestCase {
public function testPostCroppedAvatarNoSquareCrop(): void {
$this->cache->method('get')->willReturn(file_get_contents(\OC::$SERVERROOT . '/tests/data/testimage.jpg'));
$this->avatarMock->method('set')->will($this->throwException(new \OC\NotSquareException));
$this->avatarMock->method('set')->willThrowException(new \OC\NotSquareException);
$this->avatarManager->method('getAvatar')->willReturn($this->avatarMock);
$response = $this->avatarController->postCroppedAvatar(['x' => 0, 'y' => 0, 'w' => 10, 'h' => 11]);
@ -539,7 +539,7 @@ class AvatarControllerTest extends \Test\TestCase {
public function testPostCroppedAvatarException(): void {
$this->cache->method('get')->willReturn(file_get_contents(\OC::$SERVERROOT . '/tests/data/testimage.jpg'));
$this->avatarMock->method('set')->will($this->throwException(new \Exception('foo')));
$this->avatarMock->method('set')->willThrowException(new \Exception('foo'));
$this->avatarManager->method('getAvatar')->willReturn($this->avatarMock);
$this->logger->expects($this->once())

@ -96,7 +96,7 @@ class ChangePasswordControllerTest extends \Test\TestCase {
$user->expects($this->once())
->method('setPassword')
->with('new')
->will($this->throwException(new HintException('Common password')));
->willThrowException(new HintException('Common password'));
$expects = new JSONResponse([
'status' => 'error',

@ -403,7 +403,7 @@ class LostControllerTest extends TestCase {
->expects($this->once())
->method('send')
->with($message)
->will($this->throwException(new \Exception()));
->willThrowException(new \Exception());
$this->logger->expects($this->exactly(1))
->method('error');

@ -301,7 +301,7 @@ class TwoFactorChallengeControllerTest extends TestCase {
$this->twoFactorManager->expects($this->once())
->method('verifyChallenge')
->with('myprovider', $user, 'token')
->will($this->throwException($exception));
->willThrowException($exception);
$calls = [
['two_factor_auth_error_message', '2FA failed'],
['two_factor_auth_error', true],

@ -157,7 +157,7 @@ class DispatcherTest extends \Test\TestCase {
->method('beforeController')
->with($this->equalTo($this->controller),
$this->equalTo($this->controllerMethod))
->will($this->throwException($exception));
->willThrowException($exception);
if ($catchEx) {
$this->middlewareDispatcher->expects($this->once())
->method('afterException')

@ -269,7 +269,7 @@ class CORSMiddlewareTest extends \Test\TestCase {
$this->session->expects($this->once())
->method('logClientIn')
->with($this->equalTo('user'), $this->equalTo('pass'))
->will($this->throwException(new PasswordLoginForbiddenException));
->willThrowException(new PasswordLoginForbiddenException);
$this->reflector->reflect($this->controller, $method);
$middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler, $this->logger);

@ -111,7 +111,7 @@ class StoreTest extends TestCase {
public function testGetLoginCredentialsSessionNotAvailable(): void {
$this->session->expects($this->once())
->method('getId')
->will($this->throwException(new SessionNotAvailableException()));
->willThrowException(new SessionNotAvailableException());
$this->expectException(CredentialsUnavailableException::class);
$this->store->getLoginCredentials();
@ -124,7 +124,7 @@ class StoreTest extends TestCase {
$this->tokenProvider->expects($this->once())
->method('getToken')
->with('sess2233')
->will($this->throwException(new InvalidTokenException()));
->willThrowException(new InvalidTokenException());
$this->expectException(CredentialsUnavailableException::class);
$this->store->getLoginCredentials();
@ -141,7 +141,7 @@ class StoreTest extends TestCase {
$this->tokenProvider->expects($this->once())
->method('getToken')
->with('sess2233')
->will($this->throwException(new InvalidTokenException()));
->willThrowException(new InvalidTokenException());
$this->session->expects($this->once())
->method('exists')
->with($this->equalTo('login_credentials'))
@ -181,7 +181,7 @@ class StoreTest extends TestCase {
$this->tokenProvider->expects($this->once())
->method('getToken')
->with('sess2233')
->will($this->throwException(new InvalidTokenException()));
->willThrowException(new InvalidTokenException());
$this->session->expects($this->once())
->method('exists')
->with($this->equalTo('login_credentials'))
@ -222,7 +222,7 @@ class StoreTest extends TestCase {
$this->tokenProvider->expects($this->once())
->method('getToken')
->with('sess2233')
->will($this->throwException(new InvalidTokenException()));
->willThrowException(new InvalidTokenException());
$this->session->expects($this->once())
->method('exists')
->with($this->equalTo('login_credentials'))
@ -248,7 +248,7 @@ class StoreTest extends TestCase {
$this->tokenProvider->expects($this->once())
->method('getToken')
->with('sess2233')
->will($this->throwException(new PasswordlessTokenException()));
->willThrowException(new PasswordlessTokenException());
$this->expectException(CredentialsUnavailableException::class);
$this->store->getLoginCredentials();
@ -276,7 +276,7 @@ class StoreTest extends TestCase {
$this->tokenProvider->expects($this->once())
->method('getToken')
->with('sess2233')
->will($this->throwException(new PasswordlessTokenException()));
->willThrowException(new PasswordlessTokenException());
$this->session->expects($this->once())
->method('exists')

@ -39,9 +39,9 @@ class BinaryFinderTest extends TestCase {
$config
->method('getSystemValue')
->with('binary_search_paths', $this->anything())
->will($this->returnCallback(function ($key, $default) {
->willReturnCallback(function ($key, $default) {
return $default;
}));
});
$finder = new BinaryFinder($this->cacheFactory, $config);
$this->assertEquals($finder->findBinaryPath('cat'), '/usr/bin/cat');
$this->assertEquals($this->cache->get('cat'), '/usr/bin/cat');
@ -52,9 +52,9 @@ class BinaryFinderTest extends TestCase {
$config
->method('getSystemValue')
->with('binary_search_paths', $this->anything())
->will($this->returnCallback(function ($key, $default) {
->willReturnCallback(function ($key, $default) {
return $default;
}));
});
$finder = new BinaryFinder($this->cacheFactory, $config);
$this->assertFalse($finder->findBinaryPath('cata'));
$this->assertFalse($this->cache->get('cata'));

@ -150,11 +150,7 @@ class FileCacheTest extends TestCache {
->method('filemtime')
->willReturn(100);
$mockStorage->expects($this->atLeastOnce())
->method('unlink')
->will($this->onConsecutiveCalls(
$this->throwException($testException),
$this->returnValue(true)
));
->method('unlink')->willReturnOnConsecutiveCalls($this->throwException($testException), $this->returnValue(true));
$this->instance->set('key1', 'value1');
$this->instance->set('key2', 'value2');

@ -112,11 +112,11 @@ class ResourcesRoomsUpdaterTest extends TestCase {
$backend2->method('getBackendIdentifier')
->willReturn('backend2');
$backend2->method('listAllResources')
->will($this->throwException(new BackendTemporarilyUnavailableException()));
->willThrowException(new BackendTemporarilyUnavailableException());
$backend2->method('getResource')
->will($this->throwException(new BackendTemporarilyUnavailableException()));
->willThrowException(new BackendTemporarilyUnavailableException());
$backend2->method('getAllResources')
->will($this->throwException(new BackendTemporarilyUnavailableException()));
->willThrowException(new BackendTemporarilyUnavailableException());
$backend3->method('getBackendIdentifier')
->willReturn('backend3');
$backend3->method('listAllResources')

@ -47,15 +47,15 @@ class LocalTimeProviderTest extends TestCase {
$this->l = $this->createMock(IL10N::class);
$this->l->expects($this->any())
->method('t')
->will($this->returnCallback(function ($text, $parameters = []) {
->willReturnCallback(function ($text, $parameters = []) {
return vsprintf($text, $parameters);
}));
});
$this->l->expects($this->any())
->method('n')
->will($this->returnCallback(function ($text, $textPlural, $n, $parameters = []) {
->willReturnCallback(function ($text, $textPlural, $n, $parameters = []) {
$formatted = str_replace('%n', (string)$n, $n === 1 ? $text : $textPlural);
return vsprintf($formatted, $parameters);
}));
});
$this->urlGenerator = $this->createMock(IURLGenerator::class);
$this->userManager = $this->createMock(IUserManager::class);
$this->timeFactory = $this->createMock(ITimeFactory::class);

@ -44,7 +44,7 @@ class MountPointTest extends \Test\TestCase {
$loader = $this->createMock(StorageFactory::class);
$loader->expects($this->once())
->method('wrap')
->will($this->throwException(new \Exception('Test storage init exception')));
->willThrowException(new \Exception('Test storage init exception'));
$called = false;
$wrapper = function ($mountPoint, $storage) use ($called): void {

@ -153,7 +153,7 @@ class FolderTest extends NodeTestCase {
$root->method('get')
->with('/bar/foo/asd')
->will($this->throwException(new NotFoundException()));
->willThrowException(new NotFoundException());
$node = new Folder($root, $view, '/bar/foo');
$this->assertFalse($node->nodeExists('asd'));

@ -551,7 +551,7 @@ abstract class NodeTestCase extends \Test\TestCase {
$this->root->expects($this->once())
->method('get')
->with('/bar/asd')
->will($this->throwException(new NotFoundException()));
->willThrowException(new NotFoundException());
$node->copy('/bar/asd/foo');
}
@ -718,7 +718,7 @@ abstract class NodeTestCase extends \Test\TestCase {
$this->root->expects($this->once())
->method('get')
->with('/bar')
->will($this->throwException(new NotFoundException()));
->willThrowException(new NotFoundException());
$node->move('/bar/asd');
}

@ -106,7 +106,7 @@ class AvailabilityTest extends \Test\TestCase {
->method('test');
$this->storage->expects($this->once())
->method('mkdir')
->will($this->throwException(new StorageNotAvailableException()));
->willThrowException(new StorageNotAvailableException());
$this->storageCache->expects($this->once())
->method('setAvailability')
->with($this->equalTo(false));
@ -148,7 +148,7 @@ class AvailabilityTest extends \Test\TestCase {
->method('test');
$this->storage->expects($this->once())
->method('mkdir')
->will($this->throwException(new \Exception()));
->willThrowException(new \Exception());
$this->storage->expects($this->never())
->method('setAvailability');

@ -2238,13 +2238,13 @@ class ViewTest extends \Test\TestCase {
$storage->expects($this->any())
->method('getMetaData')
->will($this->returnValue([
->willReturn([
'mtime' => 1885434487,
'etag' => '',
'mimetype' => 'text/plain',
'permissions' => Constants::PERMISSION_ALL,
'size' => 3
]));
]);
$storage->expects($this->any())
->method('filemtime')
->willReturn(123456789);
@ -2433,13 +2433,13 @@ class ViewTest extends \Test\TestCase {
$storage2->expects($this->any())
->method('getMetaData')
->will($this->returnValue([
->willReturn([
'mtime' => 1885434487,
'etag' => '',
'mimetype' => 'text/plain',
'permissions' => Constants::PERMISSION_ALL,
'size' => 3
]));
]);
$storage2->expects($this->any())
->method('filemtime')
->willReturn(123456789);

@ -38,23 +38,14 @@ class MetaDataTest extends \Test\TestCase {
->getMock();
$group->expects($this->exactly(6))
->method('getGID')
->will($this->onConsecutiveCalls(
'admin', 'admin',
'g2', 'g2',
'g3', 'g3'));
->method('getGID')->willReturnOnConsecutiveCalls('admin', 'admin', 'g2', 'g2', 'g3', 'g3');
$group->expects($this->exactly(3))
->method('getDisplayName')
->will($this->onConsecutiveCalls(
'admin',
'g2',
'g3'));
->method('getDisplayName')->willReturnOnConsecutiveCalls('admin', 'g2', 'g3');
$group->expects($this->exactly($countCallCount))
->method('count')
->with('')
->will($this->onConsecutiveCalls(2, 3, 5));
->with('')->willReturnOnConsecutiveCalls(2, 3, 5);
return $group;
}

@ -66,16 +66,16 @@ class ClientTest extends \Test\TestCase {
public function testGetProxyUriProxyHostEmptyPassword(): void {
$this->config
->method('getSystemValue')
->will($this->returnValueMap([
->willReturnMap([
['proxyexclude', [], []],
]));
]);
$this->config
->method('getSystemValueString')
->will($this->returnValueMap([
->willReturnMap([
['proxy', '', 'foo'],
['proxyuserpwd', '', ''],
]));
]);
$this->assertEquals([
'http' => 'foo',
@ -254,21 +254,21 @@ class ClientTest extends \Test\TestCase {
private function setUpDefaultRequestOptions(): void {
$this->config
->method('getSystemValue')
->will($this->returnValueMap([
->willReturnMap([
['proxyexclude', [], []],
]));
]);
$this->config
->method('getSystemValueString')
->will($this->returnValueMap([
->willReturnMap([
['proxy', '', 'foo'],
['proxyuserpwd', '', ''],
]));
]);
$this->config
->method('getSystemValueBool')
->will($this->returnValueMap([
->willReturnMap([
['installed', false, true],
['allow_local_remote_servers', false, true],
]));
]);
$this->certificateManager
->expects($this->once())

@ -112,7 +112,7 @@ class CheckerTest extends TestCase {
$this->fileAccessHelper
->expects($this->once())
->method('file_put_contents')
->will($this->throwException(new \Exception('Exception message')));
->willThrowException(new \Exception('Exception message'));
$keyBundle = file_get_contents(__DIR__ . '/../../data/integritycheck/SomeApp.crt');
$rsaPrivateKey = file_get_contents(__DIR__ . '/../../data/integritycheck/SomeApp.key');
@ -446,7 +446,7 @@ class CheckerTest extends TestCase {
$this->fileAccessHelper
->expects($this->once())
->method('assertDirectoryExists')
->will($this->throwException(new \Exception('Exception message')));
->willThrowException(new \Exception('Exception message'));
$this->fileAccessHelper
->expects($this->once())
->method('is_writable')
@ -470,7 +470,7 @@ class CheckerTest extends TestCase {
$this->fileAccessHelper
->expects($this->once())
->method('assertDirectoryExists')
->will($this->throwException(new \Exception('Exception message')));
->willThrowException(new \Exception('Exception message'));
$this->fileAccessHelper
->expects($this->once())
->method('is_writable')

@ -38,9 +38,9 @@ class LoggerTest extends TestCase implements IWriter {
private function mockDefaultLogLevel(): void {
$this->config->expects($this->any())
->method('getValue')
->will(($this->returnValueMap([
->willReturnMap([
['loglevel', ILogger::WARN, ILogger::WARN],
])));
]);
}
public function testInterpolation(): void {
@ -55,10 +55,10 @@ class LoggerTest extends TestCase implements IWriter {
public function testAppCondition(): void {
$this->config->expects($this->any())
->method('getValue')
->will(($this->returnValueMap([
->willReturnMap([
['loglevel', ILogger::WARN, ILogger::WARN],
['log.condition', [], ['apps' => ['files']]]
])));
]);
$logger = $this->logger;
$logger->info('Don\'t display info messages');

@ -71,8 +71,7 @@ class CleanPreviewsBackgroundJobTest extends TestCase {
$thumbnailFolder->expects($this->never())
->method('delete');
$this->timeFactory->method('getTime')
->will($this->onConsecutiveCalls(100, 200));
$this->timeFactory->method('getTime')->willReturnOnConsecutiveCalls(100, 200);
$this->jobList->expects($this->once())
->method('add')
@ -118,8 +117,7 @@ class CleanPreviewsBackgroundJobTest extends TestCase {
$thumbnailFolder->method('getDirectoryListing')
->willReturn([$previewFolder1]);
$this->timeFactory->method('getTime')
->will($this->onConsecutiveCalls(100, 101));
$this->timeFactory->method('getTime')->willReturnOnConsecutiveCalls(100, 101);
$this->jobList->expects($this->never())
->method('add');
@ -213,8 +211,7 @@ class CleanPreviewsBackgroundJobTest extends TestCase {
$thumbnailFolder->method('getDirectoryListing')
->willReturn([$previewFolder1]);
$this->timeFactory->method('getTime')
->will($this->onConsecutiveCalls(100, 101));
$this->timeFactory->method('getTime')->willReturnOnConsecutiveCalls(100, 101);
$this->jobList->expects($this->never())
->method('add');

@ -52,10 +52,10 @@ class CleanPreviewsTest extends TestCase {
$this->userManager->expects($this->once())
->method('callForSeenUsers')
->will($this->returnCallback(function (\Closure $function) use (&$user1, $user2): void {
->willReturnCallback(function (\Closure $function) use (&$user1, $user2): void {
$function($user1);
$function($user2);
}));
});
$jobListCalls = [];
$this->jobList->expects($this->exactly(2))

@ -92,7 +92,7 @@ class RepairTest extends TestCase {
$mock = $this->createMock(TestRepairStep::class);
$mock->expects($this->any())
->method('run')
->will($this->throwException(new \Exception('Exception text')));
->willThrowException(new \Exception('Exception text'));
$mock->expects($this->any())
->method('getName')
->willReturn('Exception Test');

@ -60,11 +60,11 @@ class ResourceLocatorTest extends \Test\TestCase {
$locator->expects($this->once())
->method('doFind')
->with('foo')
->will($this->throwException(new ResourceNotFoundException('foo', 'map')));
->willThrowException(new ResourceNotFoundException('foo', 'map'));
$locator->expects($this->once())
->method('doFindTheme')
->with('foo')
->will($this->throwException(new ResourceNotFoundException('foo', 'map')));
->willThrowException(new ResourceNotFoundException('foo', 'map'));
$this->logger->expects($this->exactly(2))
->method('debug')
->with($this->stringContains('map/foo'));

@ -51,7 +51,7 @@ trait MountProviderTrait {
$this->mountProvider = $this->getMockBuilder('\OCP\Files\Config\IMountProvider')->getMock();
$this->mountProvider->expects($this->any())
->method('getMountsForUser')
->will($this->returnCallback(function (IUser $user) {
->willReturnCallback(function (IUser $user) {
if (isset($this->mounts[$user->getUID()])) {
return array_map(function ($config) {
return new MountPoint($config['storage'], $config['mountPoint'], $config['arguments'], $this->storageFactory);
@ -59,7 +59,7 @@ trait MountProviderTrait {
} else {
return [];
}
}));
});
Server::get(IMountProviderCollection::class)->registerProvider($this->mountProvider);
}
}

@ -158,7 +158,7 @@ class SessionTest extends \Test\TestCase {
$this->tokenProvider->expects($this->once())
->method('getToken')
->with('bar')
->will($this->throwException(new InvalidTokenException()));
->willThrowException(new InvalidTokenException());
$session->expects($this->exactly(2))
->method('set')
->with($this->callback(function ($key) {
@ -238,7 +238,7 @@ class SessionTest extends \Test\TestCase {
$this->tokenProvider->expects($this->once())
->method('getToken')
->with('bar')
->will($this->throwException(new InvalidTokenException()));
->willThrowException(new InvalidTokenException());
$managerMethods = get_class_methods(Manager::class);
//keep following methods intact in order to ensure hooks are working
@ -298,7 +298,7 @@ class SessionTest extends \Test\TestCase {
$this->tokenProvider->expects($this->once())
->method('getToken')
->with('bar')
->will($this->throwException(new InvalidTokenException()));
->willThrowException(new InvalidTokenException());
$user->expects($this->never())
->method('isEnabled');
@ -404,7 +404,7 @@ class SessionTest extends \Test\TestCase {
$this->tokenProvider->expects($this->once())
->method('getToken')
->with('bar')
->will($this->throwException(new InvalidTokenException()));
->willThrowException(new InvalidTokenException());
$manager->expects($this->once())
->method('checkPasswordNoLogging')
@ -430,7 +430,7 @@ class SessionTest extends \Test\TestCase {
$this->tokenProvider->expects($this->once())
->method('getToken')
->with('doe')
->will($this->throwException(new InvalidTokenException()));
->willThrowException(new InvalidTokenException());
$this->config->expects($this->once())
->method('getSystemValueBool')
->with('token_auth_enforced', false)
@ -466,7 +466,7 @@ class SessionTest extends \Test\TestCase {
$this->tokenProvider->expects($this->once())
->method('getToken')
->with('doe')
->will($this->throwException(new InvalidTokenException()));
->willThrowException(new InvalidTokenException());
$this->config->expects($this->once())
->method('getSystemValueBool')
->with('token_auth_enforced', false)
@ -534,7 +534,7 @@ class SessionTest extends \Test\TestCase {
$this->tokenProvider->expects($this->once())
->method('getToken')
->with('doe')
->will($this->throwException(new InvalidTokenException()));
->willThrowException(new InvalidTokenException());
$this->config->expects($this->once())
->method('getSystemValueBool')
->with('token_auth_enforced', false)
@ -788,7 +788,7 @@ class SessionTest extends \Test\TestCase {
$this->tokenProvider->expects($this->once())
->method('renewSessionToken')
->with($oldSessionId, $sessionId)
->will($this->throwException(new InvalidTokenException()));
->willThrowException(new InvalidTokenException());
$user->expects($this->never())
->method('getUID')
@ -972,7 +972,7 @@ class SessionTest extends \Test\TestCase {
$this->tokenProvider->expects($this->once())
->method('getToken')
->with($password)
->will($this->throwException(new InvalidTokenException()));
->willThrowException(new InvalidTokenException());
$this->tokenProvider->expects($this->once())
->method('generateToken')
@ -1013,7 +1013,7 @@ class SessionTest extends \Test\TestCase {
$this->tokenProvider->expects($this->once())
->method('getToken')
->with($password)
->will($this->throwException(new InvalidTokenException()));
->willThrowException(new InvalidTokenException());
$this->tokenProvider->expects($this->once())
->method('generateToken')

@ -832,9 +832,9 @@ class UserTest extends TestCase {
['files', 'allow_unlimited_quota', '1', '1'],
];
$config->method('getUserValue')
->will($this->returnValueMap($userValueMap));
->willReturnMap($userValueMap);
$config->method('getAppValue')
->will($this->returnValueMap($appValueMap));
->willReturnMap($appValueMap);
$this->assertEquals('none', $user->getQuota());
$this->assertEquals(FileInfo::SPACE_UNLIMITED, $user->getQuotaBytes());
@ -866,9 +866,9 @@ class UserTest extends TestCase {
['files', 'default_quota', '1 GB', '1 GB'],
];
$config->method('getUserValue')
->will($this->returnValueMap($userValueMap));
->willReturnMap($userValueMap);
$config->method('getAppValue')
->will($this->returnValueMap($appValueMap));
->willReturnMap($appValueMap);
$this->assertEquals('1 GB', $user->getQuota());
$this->assertEquals(1024 * 1024 * 1024, $user->getQuotaBytes());

Loading…
Cancel
Save