aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/AppFramework/Http/DispatcherTest.php2
-rw-r--r--tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php2
-rw-r--r--tests/lib/Authentication/LoginCredentials/StoreTest.php14
-rw-r--r--tests/lib/BinaryFinderTest.php8
-rw-r--r--tests/lib/Cache/FileCacheTest.php6
-rw-r--r--tests/lib/Calendar/ResourcesRoomsUpdaterTest.php6
-rw-r--r--tests/lib/Contacts/ContactsMenu/Providers/LocalTimeProviderTest.php8
-rw-r--r--tests/lib/Files/Mount/MountPointTest.php2
-rw-r--r--tests/lib/Files/Node/FolderTest.php2
-rw-r--r--tests/lib/Files/Node/NodeTestCase.php4
-rw-r--r--tests/lib/Files/Storage/Wrapper/AvailabilityTest.php4
-rw-r--r--tests/lib/Files/ViewTest.php8
-rw-r--r--tests/lib/Group/MetaDataTest.php15
-rw-r--r--tests/lib/Http/Client/ClientTest.php20
-rw-r--r--tests/lib/IntegrityCheck/CheckerTest.php6
-rw-r--r--tests/lib/LoggerTest.php8
-rw-r--r--tests/lib/Repair/Owncloud/CleanPreviewsBackgroundJobTest.php9
-rw-r--r--tests/lib/Repair/Owncloud/CleanPreviewsTest.php4
-rw-r--r--tests/lib/RepairTest.php2
-rw-r--r--tests/lib/Template/ResourceLocatorTest.php4
-rw-r--r--tests/lib/Traits/MountProviderTrait.php4
-rw-r--r--tests/lib/User/SessionTest.php20
-rw-r--r--tests/lib/User/UserTest.php8
23 files changed, 75 insertions, 91 deletions
diff --git a/tests/lib/AppFramework/Http/DispatcherTest.php b/tests/lib/AppFramework/Http/DispatcherTest.php
index 68b88acfb10..4ed6627891c 100644
--- a/tests/lib/AppFramework/Http/DispatcherTest.php
+++ b/tests/lib/AppFramework/Http/DispatcherTest.php
@@ -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')
diff --git a/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php
index 5e923d5a564..2132a4d511f 100644
--- a/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php
@@ -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);
diff --git a/tests/lib/Authentication/LoginCredentials/StoreTest.php b/tests/lib/Authentication/LoginCredentials/StoreTest.php
index 072ec2ab571..aca586b91ec 100644
--- a/tests/lib/Authentication/LoginCredentials/StoreTest.php
+++ b/tests/lib/Authentication/LoginCredentials/StoreTest.php
@@ -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')
diff --git a/tests/lib/BinaryFinderTest.php b/tests/lib/BinaryFinderTest.php
index 42306e49eac..af7bf8b9126 100644
--- a/tests/lib/BinaryFinderTest.php
+++ b/tests/lib/BinaryFinderTest.php
@@ -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'));
diff --git a/tests/lib/Cache/FileCacheTest.php b/tests/lib/Cache/FileCacheTest.php
index af5b3a8abba..a60609782f0 100644
--- a/tests/lib/Cache/FileCacheTest.php
+++ b/tests/lib/Cache/FileCacheTest.php
@@ -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');
diff --git a/tests/lib/Calendar/ResourcesRoomsUpdaterTest.php b/tests/lib/Calendar/ResourcesRoomsUpdaterTest.php
index 7776ba8cd3a..9e54d21fda4 100644
--- a/tests/lib/Calendar/ResourcesRoomsUpdaterTest.php
+++ b/tests/lib/Calendar/ResourcesRoomsUpdaterTest.php
@@ -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')
diff --git a/tests/lib/Contacts/ContactsMenu/Providers/LocalTimeProviderTest.php b/tests/lib/Contacts/ContactsMenu/Providers/LocalTimeProviderTest.php
index 7b1e6249832..198ec6c672e 100644
--- a/tests/lib/Contacts/ContactsMenu/Providers/LocalTimeProviderTest.php
+++ b/tests/lib/Contacts/ContactsMenu/Providers/LocalTimeProviderTest.php
@@ -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);
diff --git a/tests/lib/Files/Mount/MountPointTest.php b/tests/lib/Files/Mount/MountPointTest.php
index fee4e717300..af66a9028eb 100644
--- a/tests/lib/Files/Mount/MountPointTest.php
+++ b/tests/lib/Files/Mount/MountPointTest.php
@@ -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 {
diff --git a/tests/lib/Files/Node/FolderTest.php b/tests/lib/Files/Node/FolderTest.php
index 9b04dcf5c3b..53e8f07a0d3 100644
--- a/tests/lib/Files/Node/FolderTest.php
+++ b/tests/lib/Files/Node/FolderTest.php
@@ -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'));
diff --git a/tests/lib/Files/Node/NodeTestCase.php b/tests/lib/Files/Node/NodeTestCase.php
index b9bcacdb0d4..6da4e1e9317 100644
--- a/tests/lib/Files/Node/NodeTestCase.php
+++ b/tests/lib/Files/Node/NodeTestCase.php
@@ -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');
}
diff --git a/tests/lib/Files/Storage/Wrapper/AvailabilityTest.php b/tests/lib/Files/Storage/Wrapper/AvailabilityTest.php
index 9d237d28d6f..8e2ead4a423 100644
--- a/tests/lib/Files/Storage/Wrapper/AvailabilityTest.php
+++ b/tests/lib/Files/Storage/Wrapper/AvailabilityTest.php
@@ -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');
diff --git a/tests/lib/Files/ViewTest.php b/tests/lib/Files/ViewTest.php
index f11a1fc16d8..36e448ea6e2 100644
--- a/tests/lib/Files/ViewTest.php
+++ b/tests/lib/Files/ViewTest.php
@@ -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);
diff --git a/tests/lib/Group/MetaDataTest.php b/tests/lib/Group/MetaDataTest.php
index f02aa146307..1b58432fd88 100644
--- a/tests/lib/Group/MetaDataTest.php
+++ b/tests/lib/Group/MetaDataTest.php
@@ -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;
}
diff --git a/tests/lib/Http/Client/ClientTest.php b/tests/lib/Http/Client/ClientTest.php
index f2a3c34beb4..2c0f982c51c 100644
--- a/tests/lib/Http/Client/ClientTest.php
+++ b/tests/lib/Http/Client/ClientTest.php
@@ -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())
diff --git a/tests/lib/IntegrityCheck/CheckerTest.php b/tests/lib/IntegrityCheck/CheckerTest.php
index cd87e3dd27a..fc540707c70 100644
--- a/tests/lib/IntegrityCheck/CheckerTest.php
+++ b/tests/lib/IntegrityCheck/CheckerTest.php
@@ -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')
diff --git a/tests/lib/LoggerTest.php b/tests/lib/LoggerTest.php
index 2880fc53fd1..972626eccb4 100644
--- a/tests/lib/LoggerTest.php
+++ b/tests/lib/LoggerTest.php
@@ -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');
diff --git a/tests/lib/Repair/Owncloud/CleanPreviewsBackgroundJobTest.php b/tests/lib/Repair/Owncloud/CleanPreviewsBackgroundJobTest.php
index b68346fb5f2..7a60bdd18ea 100644
--- a/tests/lib/Repair/Owncloud/CleanPreviewsBackgroundJobTest.php
+++ b/tests/lib/Repair/Owncloud/CleanPreviewsBackgroundJobTest.php
@@ -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');
diff --git a/tests/lib/Repair/Owncloud/CleanPreviewsTest.php b/tests/lib/Repair/Owncloud/CleanPreviewsTest.php
index c8b7ab85fe9..c0ea6f5bc1f 100644
--- a/tests/lib/Repair/Owncloud/CleanPreviewsTest.php
+++ b/tests/lib/Repair/Owncloud/CleanPreviewsTest.php
@@ -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))
diff --git a/tests/lib/RepairTest.php b/tests/lib/RepairTest.php
index d968049c02c..f567aebf3c8 100644
--- a/tests/lib/RepairTest.php
+++ b/tests/lib/RepairTest.php
@@ -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');
diff --git a/tests/lib/Template/ResourceLocatorTest.php b/tests/lib/Template/ResourceLocatorTest.php
index 65d4c7938f9..311cf317129 100644
--- a/tests/lib/Template/ResourceLocatorTest.php
+++ b/tests/lib/Template/ResourceLocatorTest.php
@@ -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'));
diff --git a/tests/lib/Traits/MountProviderTrait.php b/tests/lib/Traits/MountProviderTrait.php
index 92ec1628a33..479e702e2f1 100644
--- a/tests/lib/Traits/MountProviderTrait.php
+++ b/tests/lib/Traits/MountProviderTrait.php
@@ -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);
}
}
diff --git a/tests/lib/User/SessionTest.php b/tests/lib/User/SessionTest.php
index 8e017772348..685b7c13d44 100644
--- a/tests/lib/User/SessionTest.php
+++ b/tests/lib/User/SessionTest.php
@@ -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')
diff --git a/tests/lib/User/UserTest.php b/tests/lib/User/UserTest.php
index d8073abf8c8..e386d0c2c10 100644
--- a/tests/lib/User/UserTest.php
+++ b/tests/lib/User/UserTest.php
@@ -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());