summaryrefslogtreecommitdiffstats
path: root/tests/lib/Files
diff options
context:
space:
mode:
authorChristoph Wurst <ChristophWurst@users.noreply.github.com>2020-03-26 09:25:19 +0100
committerGitHub <noreply@github.com>2020-03-26 09:25:19 +0100
commit25ab122245da1456701d93d7178f851b660c3cf7 (patch)
tree0365dc30da369f4fe033186302511aab6687a68b /tests/lib/Files
parentb3af054d73801267590e77ae137c56ea0086d6a0 (diff)
parent2ee65f177e4f7e09ad2287f14d564e7068d322fb (diff)
downloadnextcloud-server-25ab122245da1456701d93d7178f851b660c3cf7.tar.gz
nextcloud-server-25ab122245da1456701d93d7178f851b660c3cf7.zip
Merge pull request #20172 from nextcloud/techdebt/phpunit-short-return
Use the shorter phpunit syntax for mocked return values
Diffstat (limited to 'tests/lib/Files')
-rw-r--r--tests/lib/Files/Cache/CacheTest.php2
-rw-r--r--tests/lib/Files/Config/UserMountCacheTest.php16
-rw-r--r--tests/lib/Files/Mount/MountPointTest.php4
-rw-r--r--tests/lib/Files/Node/FileTest.php32
-rw-r--r--tests/lib/Files/Node/FolderTest.php170
-rw-r--r--tests/lib/Files/Node/NodeTest.php116
-rw-r--r--tests/lib/Files/Node/RootTest.php4
-rw-r--r--tests/lib/Files/Storage/Wrapper/QuotaTest.php10
-rw-r--r--tests/lib/Files/Stream/EncryptionTest.php4
-rw-r--r--tests/lib/Files/Type/DetectionTest.php8
-rw-r--r--tests/lib/Files/Utils/ScannerTest.php8
-rw-r--r--tests/lib/Files/ViewTest.php56
12 files changed, 215 insertions, 215 deletions
diff --git a/tests/lib/Files/Cache/CacheTest.php b/tests/lib/Files/Cache/CacheTest.php
index b2816c03094..247ed9ef9ec 100644
--- a/tests/lib/Files/Cache/CacheTest.php
+++ b/tests/lib/Files/Cache/CacheTest.php
@@ -544,7 +544,7 @@ class CacheTest extends \Test\TestCase {
$cacheMock->expects($this->any())
->method('normalize')
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$data = array('size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory');
diff --git a/tests/lib/Files/Config/UserMountCacheTest.php b/tests/lib/Files/Config/UserMountCacheTest.php
index 2f61f634ffb..6f347a504cb 100644
--- a/tests/lib/Files/Config/UserMountCacheTest.php
+++ b/tests/lib/Files/Config/UserMountCacheTest.php
@@ -77,24 +77,24 @@ class UserMountCacheTest extends TestCase {
->getMock();
$storageCache->expects($this->any())
->method('getNumericId')
- ->will($this->returnValue($storageId));
+ ->willReturn($storageId);
$cache = $this->getMockBuilder('\OC\Files\Cache\Cache')
->disableOriginalConstructor()
->getMock();
$cache->expects($this->any())
->method('getId')
- ->will($this->returnValue($rootId));
+ ->willReturn($rootId);
$storage = $this->getMockBuilder('\OC\Files\Storage\Storage')
->disableOriginalConstructor()
->getMock();
$storage->expects($this->any())
->method('getStorageCache')
- ->will($this->returnValue($storageCache));
+ ->willReturn($storageCache);
$storage->expects($this->any())
->method('getCache')
- ->will($this->returnValue($cache));
+ ->willReturn($cache);
return [$storage, $rootId];
}
@@ -401,7 +401,7 @@ class UserMountCacheTest extends TestCase {
$mount1->expects($this->any())
->method('getStorageRootId')
- ->will($this->returnValue($folderId));
+ ->willReturn($folderId);
$this->cache->registerMounts($user1, [$mount1]);
@@ -434,7 +434,7 @@ class UserMountCacheTest extends TestCase {
$mount1->expects($this->any())
->method('getStorageRootId')
- ->will($this->returnValue($folderId));
+ ->willReturn($folderId);
$this->cache->registerMounts($user1, [$mount1]);
@@ -481,11 +481,11 @@ class UserMountCacheTest extends TestCase {
$mount1->expects($this->any())
->method('getStorageRootId')
- ->will($this->returnValue($rootId));
+ ->willReturn($rootId);
$mount1->expects($this->any())
->method('getNumericStorageId')
- ->will($this->returnValue(2));
+ ->willReturn(2);
$this->cache->registerMounts($user1, [$mount1]);
diff --git a/tests/lib/Files/Mount/MountPointTest.php b/tests/lib/Files/Mount/MountPointTest.php
index 9b63c507b5f..800b360415a 100644
--- a/tests/lib/Files/Mount/MountPointTest.php
+++ b/tests/lib/Files/Mount/MountPointTest.php
@@ -21,12 +21,12 @@ class MountPointTest extends \Test\TestCase {
$storage = $this->createMock(Storage::class);
$storage->expects($this->once())
->method('getId')
- ->will($this->returnValue(123));
+ ->willReturn(123);
$loader = $this->createMock(StorageFactory::class);
$loader->expects($this->once())
->method('wrap')
- ->will($this->returnValue($storage));
+ ->willReturn($storage);
$mountPoint = new \OC\Files\Mount\MountPoint(
// just use this because a real class is needed
diff --git a/tests/lib/Files/Node/FileTest.php b/tests/lib/Files/Node/FileTest.php
index 2cdf9cbdc5a..69d31b28a96 100644
--- a/tests/lib/Files/Node/FileTest.php
+++ b/tests/lib/Files/Node/FileTest.php
@@ -48,12 +48,12 @@ class FileTest extends NodeTest {
$this->view->expects($this->once())
->method('file_get_contents')
->with('/bar/foo')
- ->will($this->returnValue('bar'));
+ ->willReturn('bar');
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ)));
$node = new \OC\Files\Node\File($root, $this->view, '/bar/foo');
$this->assertEquals('bar', $node->getContent());
@@ -70,12 +70,12 @@ class FileTest extends NodeTest {
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => 0))));
+ ->willReturn($this->getFileInfo(array('permissions' => 0)));
$node = new \OC\Files\Node\File($root, $this->view, '/bar/foo');
$node->getContent();
@@ -89,17 +89,17 @@ class FileTest extends NodeTest {
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL)));
$this->view->expects($this->once())
->method('file_put_contents')
->with('/bar/foo', 'bar')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$node = new \OC\Files\Node\File($root, $this->view, '/bar/foo');
$node->putContent('bar');
@@ -117,7 +117,7 @@ class FileTest extends NodeTest {
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ)));
$node = new \OC\Files\Node\File($root, $this->view, '/bar/foo');
$node->putContent('bar');
@@ -132,7 +132,7 @@ class FileTest extends NodeTest {
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('mimetype' => 'text/plain'))));
+ ->willReturn($this->getFileInfo(array('mimetype' => 'text/plain')));
$node = new \OC\Files\Node\File($root, $this->view, '/bar/foo');
$this->assertEquals('text/plain', $node->getMimeType());
@@ -162,12 +162,12 @@ class FileTest extends NodeTest {
$this->view->expects($this->once())
->method('fopen')
->with('/bar/foo', 'r')
- ->will($this->returnValue($stream));
+ ->willReturn($stream);
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL)));
$node = new \OC\Files\Node\File($root, $this->view, '/bar/foo');
$fh = $node->fopen('r');
@@ -197,12 +197,12 @@ class FileTest extends NodeTest {
$this->view->expects($this->once())
->method('fopen')
->with('/bar/foo', 'w')
- ->will($this->returnValue($stream));
+ ->willReturn($stream);
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL)));
$node = new \OC\Files\Node\File($root, $this->view, '/bar/foo');
$fh = $node->fopen('w');
@@ -232,7 +232,7 @@ class FileTest extends NodeTest {
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => 0))));
+ ->willReturn($this->getFileInfo(array('permissions' => 0)));
$node = new \OC\Files\Node\File($root, $this->view, '/bar/foo');
$node->fopen('r');
@@ -257,7 +257,7 @@ class FileTest extends NodeTest {
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_UPDATE))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_UPDATE)));
$node = new \OC\Files\Node\File($root, $this->view, '/bar/foo');
$node->fopen('w');
@@ -282,7 +282,7 @@ class FileTest extends NodeTest {
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ)));
$node = new \OC\Files\Node\File($root, $this->view, '/bar/foo');
$node->fopen('w');
diff --git a/tests/lib/Files/Node/FolderTest.php b/tests/lib/Files/Node/FolderTest.php
index d33fb4f68f8..979c7fd6da6 100644
--- a/tests/lib/Files/Node/FolderTest.php
+++ b/tests/lib/Files/Node/FolderTest.php
@@ -59,15 +59,15 @@ class FolderTest extends NodeTest {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$view->expects($this->any())
->method('getDirectoryContent')
->with('/bar/foo')
- ->will($this->returnValue(array(
+ ->willReturn(array(
new FileInfo('/bar/foo/asd', null, 'foo/asd', ['fileid' => 2, 'path' => '/bar/foo/asd', 'name' => 'asd', 'size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain'], null),
new FileInfo('/bar/foo/qwerty', null, 'foo/qwerty', ['fileid' => 3, 'path' => '/bar/foo/qwerty', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'httpd/unix-directory'], null)
- )));
+ ));
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$children = $node->getDirectoryListing();
@@ -91,7 +91,7 @@ class FolderTest extends NodeTest {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$root->expects($this->once())
->method('get')
@@ -112,14 +112,14 @@ class FolderTest extends NodeTest {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$child = new \OC\Files\Node\Folder($root, $view, '/bar/foo/asd');
$root->expects($this->once())
->method('get')
->with('/bar/foo/asd')
- ->will($this->returnValue($child));
+ ->willReturn($child);
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$this->assertTrue($node->nodeExists('asd'));
@@ -136,7 +136,7 @@ class FolderTest extends NodeTest {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$root->expects($this->once())
->method('get')
@@ -158,17 +158,17 @@ class FolderTest extends NodeTest {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL)));
$view->expects($this->once())
->method('mkdir')
->with('/bar/foo/asd')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$child = new \OC\Files\Node\Folder($root, $view, '/bar/foo/asd');
@@ -190,12 +190,12 @@ class FolderTest extends NodeTest {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ)));
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$node->newFolder('asd');
@@ -212,17 +212,17 @@ class FolderTest extends NodeTest {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL)));
$view->expects($this->once())
->method('touch')
->with('/bar/foo/asd')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$child = new \OC\Files\Node\File($root, $view, '/bar/foo/asd');
@@ -244,12 +244,12 @@ class FolderTest extends NodeTest {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ)));
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$node->newFile('asd');
@@ -266,12 +266,12 @@ class FolderTest extends NodeTest {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$view->expects($this->once())
->method('free_space')
->with('/bar/foo')
- ->will($this->returnValue(100));
+ ->willReturn(100);
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$this->assertEquals(100, $node->getFreeSpace());
@@ -288,39 +288,39 @@ class FolderTest extends NodeTest {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$storage = $this->createMock(Storage::class);
$storage->method('getId')->willReturn('');
$cache = $this->getMockBuilder(Cache::class)->setConstructorArgs([$storage])->getMock();
$storage->expects($this->once())
->method('getCache')
- ->will($this->returnValue($cache));
+ ->willReturn($cache);
$mount = $this->createMock(IMountPoint::class);
$mount->expects($this->once())
->method('getStorage')
- ->will($this->returnValue($storage));
+ ->willReturn($storage);
$mount->expects($this->once())
->method('getInternalPath')
- ->will($this->returnValue('foo'));
+ ->willReturn('foo');
$cache->expects($this->once())
->method('search')
->with('%qw%')
- ->will($this->returnValue(array(
+ ->willReturn(array(
array('fileid' => 3, 'path' => 'foo/qwerty', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain')
- )));
+ ));
$root->expects($this->once())
->method('getMountsIn')
->with('/bar/foo')
- ->will($this->returnValue(array()));
+ ->willReturn(array());
$root->expects($this->once())
->method('getMount')
->with('/bar/foo')
- ->will($this->returnValue($mount));
+ ->willReturn($mount);
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$result = $node->search('qw');
@@ -340,7 +340,7 @@ class FolderTest extends NodeTest {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
/** @var \PHPUnit_Framework_MockObject_MockObject|Storage $storage */
$storage = $this->createMock(Storage::class);
$storage->method('getId')->willReturn('');
@@ -349,32 +349,32 @@ class FolderTest extends NodeTest {
$mount = $this->createMock(IMountPoint::class);
$mount->expects($this->once())
->method('getStorage')
- ->will($this->returnValue($storage));
+ ->willReturn($storage);
$mount->expects($this->once())
->method('getInternalPath')
- ->will($this->returnValue('files'));
+ ->willReturn('files');
$storage->expects($this->once())
->method('getCache')
- ->will($this->returnValue($cache));
+ ->willReturn($cache);
$cache->expects($this->once())
->method('search')
->with('%qw%')
- ->will($this->returnValue(array(
+ ->willReturn(array(
array('fileid' => 3, 'path' => 'files/foo', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain'),
array('fileid' => 3, 'path' => 'files_trashbin/foo2.d12345', 'name' => 'foo2.d12345', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain'),
- )));
+ ));
$root->expects($this->once())
->method('getMountsIn')
->with('')
- ->will($this->returnValue(array()));
+ ->willReturn(array());
$root->expects($this->once())
->method('getMount')
->with('')
- ->will($this->returnValue($mount));
+ ->willReturn($mount);
$result = $root->search('qw');
$this->assertEquals(1, count($result));
@@ -392,7 +392,7 @@ class FolderTest extends NodeTest {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$storage = $this->createMock(Storage::class);
$storage->method('getId')->willReturn('');
$cache = $this->getMockBuilder(Cache::class)->setConstructorArgs([$storage])->getMock();
@@ -400,31 +400,31 @@ class FolderTest extends NodeTest {
$mount = $this->createMock(IMountPoint::class);
$mount->expects($this->once())
->method('getStorage')
- ->will($this->returnValue($storage));
+ ->willReturn($storage);
$mount->expects($this->once())
->method('getInternalPath')
- ->will($this->returnValue(''));
+ ->willReturn('');
$storage->expects($this->once())
->method('getCache')
- ->will($this->returnValue($cache));
+ ->willReturn($cache);
$cache->expects($this->once())
->method('search')
->with('%qw%')
- ->will($this->returnValue(array(
+ ->willReturn(array(
array('fileid' => 3, 'path' => 'foo/qwerty', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain')
- )));
+ ));
$root->expects($this->once())
->method('getMountsIn')
->with('/bar')
- ->will($this->returnValue(array()));
+ ->willReturn(array());
$root->expects($this->once())
->method('getMount')
->with('/bar')
- ->will($this->returnValue($mount));
+ ->willReturn($mount);
$node = new \OC\Files\Node\Folder($root, $view, '/bar');
$result = $node->search('qw');
@@ -443,7 +443,7 @@ class FolderTest extends NodeTest {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$storage = $this->createMock(Storage::class);
$storage->method('getId')->willReturn('');
$cache = $this->getMockBuilder(Cache::class)->setConstructorArgs([$storage])->getMock();
@@ -454,50 +454,50 @@ class FolderTest extends NodeTest {
$mount = $this->createMock(IMountPoint::class);
$mount->expects($this->once())
->method('getStorage')
- ->will($this->returnValue($storage));
+ ->willReturn($storage);
$mount->expects($this->once())
->method('getInternalPath')
- ->will($this->returnValue('foo'));
+ ->willReturn('foo');
$subMount->expects($this->once())
->method('getStorage')
- ->will($this->returnValue($subStorage));
+ ->willReturn($subStorage);
$subMount->expects($this->once())
->method('getMountPoint')
- ->will($this->returnValue('/bar/foo/bar/'));
+ ->willReturn('/bar/foo/bar/');
$storage->expects($this->once())
->method('getCache')
- ->will($this->returnValue($cache));
+ ->willReturn($cache);
$subStorage->expects($this->once())
->method('getCache')
- ->will($this->returnValue($subCache));
+ ->willReturn($subCache);
$cache->expects($this->once())
->method('search')
->with('%qw%')
- ->will($this->returnValue(array(
+ ->willReturn(array(
array('fileid' => 3, 'path' => 'foo/qwerty', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain')
- )));
+ ));
$subCache->expects($this->once())
->method('search')
->with('%qw%')
- ->will($this->returnValue(array(
+ ->willReturn(array(
array('fileid' => 4, 'path' => 'asd/qweasd', 'name' => 'qweasd', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain')
- )));
+ ));
$root->expects($this->once())
->method('getMountsIn')
->with('/bar/foo')
- ->will($this->returnValue(array($subMount)));
+ ->willReturn(array($subMount));
$root->expects($this->once())
->method('getMount')
->with('/bar/foo')
- ->will($this->returnValue($mount));
+ ->willReturn($mount);
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
@@ -534,34 +534,34 @@ class FolderTest extends NodeTest {
$storage->expects($this->once())
->method('getCache')
- ->will($this->returnValue($cache));
+ ->willReturn($cache);
$this->userMountCache->expects($this->any())
->method('getMountsForFileId')
->with(1)
- ->will($this->returnValue([new CachedMountInfo(
+ ->willReturn([new CachedMountInfo(
$this->user,
1,
0,
'/bar/',
1,
''
- )]));
+ )]);
$cache->expects($this->once())
->method('get')
->with(1)
- ->will($this->returnValue($fileInfo));
+ ->willReturn($fileInfo);
$root->expects($this->once())
->method('getMountsIn')
->with('/bar/foo')
- ->will($this->returnValue(array()));
+ ->willReturn(array());
$root->expects($this->once())
->method('getMount')
->with('/bar/foo')
- ->will($this->returnValue($mount));
+ ->willReturn($mount);
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$result = $node->getById(1);
@@ -588,29 +588,29 @@ class FolderTest extends NodeTest {
$storage->expects($this->once())
->method('getCache')
- ->will($this->returnValue($cache));
+ ->willReturn($cache);
$this->userMountCache->expects($this->any())
->method('getMountsForFileId')
->with(1)
- ->will($this->returnValue([new CachedMountInfo(
+ ->willReturn([new CachedMountInfo(
$this->user,
1,
0,
'/bar/',
1,
''
- )]));
+ )]);
$cache->expects($this->once())
->method('get')
->with(1)
- ->will($this->returnValue($fileInfo));
+ ->willReturn($fileInfo);
$root->expects($this->once())
->method('getMount')
->with('/bar')
- ->will($this->returnValue($mount));
+ ->willReturn($mount);
$node = new \OC\Files\Node\Folder($root, $view, '/bar');
$result = $node->getById(1);
@@ -637,34 +637,34 @@ class FolderTest extends NodeTest {
$storage->expects($this->once())
->method('getCache')
- ->will($this->returnValue($cache));
+ ->willReturn($cache);
$this->userMountCache->expects($this->any())
->method('getMountsForFileId')
->with(1)
- ->will($this->returnValue([new CachedMountInfo(
+ ->willReturn([new CachedMountInfo(
$this->user,
1,
0,
'/bar/',
1,
''
- )]));
+ )]);
$cache->expects($this->once())
->method('get')
->with(1)
- ->will($this->returnValue($fileInfo));
+ ->willReturn($fileInfo);
$root->expects($this->once())
->method('getMountsIn')
->with('/bar/foo')
- ->will($this->returnValue(array()));
+ ->willReturn(array());
$root->expects($this->once())
->method('getMount')
->with('/bar/foo')
- ->will($this->returnValue($mount));
+ ->willReturn($mount);
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$result = $node->getById(1);
@@ -691,12 +691,12 @@ class FolderTest extends NodeTest {
$storage->expects($this->exactly(2))
->method('getCache')
- ->will($this->returnValue($cache));
+ ->willReturn($cache);
$this->userMountCache->expects($this->any())
->method('getMountsForFileId')
->with(1)
- ->will($this->returnValue([
+ ->willReturn([
new CachedMountInfo(
$this->user,
1,
@@ -713,26 +713,26 @@ class FolderTest extends NodeTest {
1,
''
)
- ]));
+ ]);
$storage->expects($this->any())
->method('getCache')
- ->will($this->returnValue($cache));
+ ->willReturn($cache);
$cache->expects($this->any())
->method('get')
->with(1)
- ->will($this->returnValue($fileInfo));
+ ->willReturn($fileInfo);
$root->expects($this->any())
->method('getMountsIn')
->with('/bar/foo')
- ->will($this->returnValue(array($mount2)));
+ ->willReturn(array($mount2));
$root->expects($this->once())
->method('getMount')
->with('/bar/foo')
- ->will($this->returnValue($mount1));
+ ->willReturn($mount1);
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$result = $node->getById(1);
@@ -767,14 +767,14 @@ class FolderTest extends NodeTest {
$view->expects($this->any())
->method('file_exists')
- ->will($this->returnCallback(function ($path) use ($existingFiles, $folderPath) {
+ ->willReturnCallback(function ($path) use ($existingFiles, $folderPath) {
foreach ($existingFiles as $existing) {
if ($folderPath . '/' . $existing === $path) {
return true;
}
}
return false;
- }));
+ });
$node = new \OC\Files\Node\Folder($root, $view, $folderPath);
$this->assertEquals($expected, $node->getNonExistingName($name));
@@ -802,7 +802,7 @@ class FolderTest extends NodeTest {
$folderInfo->expects($this->any())
->method('getMountPoint')
- ->will($this->returnValue($mount));
+ ->willReturn($mount);
$cache = $storage->getCache();
@@ -866,7 +866,7 @@ class FolderTest extends NodeTest {
$folderInfo->expects($this->any())
->method('getMountPoint')
- ->will($this->returnValue($mount));
+ ->willReturn($mount);
$cache = $storage->getCache();
@@ -932,7 +932,7 @@ class FolderTest extends NodeTest {
$folderInfo->expects($this->any())
->method('getMountPoint')
- ->will($this->returnValue($mount));
+ ->willReturn($mount);
$cache = $storage->getCache();
diff --git a/tests/lib/Files/Node/NodeTest.php b/tests/lib/Files/Node/NodeTest.php
index 7c8ddee6b5f..18cc4d80574 100644
--- a/tests/lib/Files/Node/NodeTest.php
+++ b/tests/lib/Files/Node/NodeTest.php
@@ -92,7 +92,7 @@ abstract class NodeTest extends \Test\TestCase {
->getMock();
$storage->expects($this->any())
->method('getId')
- ->will($this->returnValue('home::someuser'));
+ ->willReturn('home::someuser');
return $storage;
}
@@ -103,20 +103,20 @@ abstract class NodeTest extends \Test\TestCase {
public function testDelete() {
$this->root->expects($this->exactly(2))
->method('emit')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL])));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL]));
$this->view->expects($this->once())
->method($this->getViewDeleteMethod())
->with('/bar/foo')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$node->delete();
@@ -163,17 +163,17 @@ abstract class NodeTest extends \Test\TestCase {
$this->view->expects($this->any())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1, 'mimetype' => 'text/plain'])));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1, 'mimetype' => 'text/plain']));
$this->view->expects($this->once())
->method($this->getViewDeleteMethod())
->with('/bar/foo')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->view->expects($this->any())
->method('resolvePath')
->with('/bar/foo')
- ->will($this->returnValue([null, 'foo']));
+ ->willReturn([null, 'foo']);
$node = $this->createTestNode($root, $this->view, '/bar/foo');
$node->delete();
@@ -186,12 +186,12 @@ abstract class NodeTest extends \Test\TestCase {
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ])));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ]));
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$node->delete();
@@ -201,7 +201,7 @@ abstract class NodeTest extends \Test\TestCase {
public function testStat() {
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$stat = array(
'fileid' => 1,
@@ -214,7 +214,7 @@ abstract class NodeTest extends \Test\TestCase {
$this->view->expects($this->once())
->method('stat')
->with('/bar/foo')
- ->will($this->returnValue($stat));
+ ->willReturn($stat);
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$this->assertEquals($stat, $node->stat());
@@ -223,7 +223,7 @@ abstract class NodeTest extends \Test\TestCase {
public function testGetId() {
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$stat = $this->getFileInfo(array(
'fileid' => 1,
@@ -235,7 +235,7 @@ abstract class NodeTest extends \Test\TestCase {
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($stat));
+ ->willReturn($stat);
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$this->assertEquals(1, $node->getId());
@@ -244,7 +244,7 @@ abstract class NodeTest extends \Test\TestCase {
public function testGetSize() {
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$stat = $this->getFileInfo(array(
@@ -257,7 +257,7 @@ abstract class NodeTest extends \Test\TestCase {
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($stat));
+ ->willReturn($stat);
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$this->assertEquals(100, $node->getSize());
@@ -266,7 +266,7 @@ abstract class NodeTest extends \Test\TestCase {
public function testGetEtag() {
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$stat = $this->getFileInfo(array(
'fileid' => 1,
@@ -278,7 +278,7 @@ abstract class NodeTest extends \Test\TestCase {
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($stat));
+ ->willReturn($stat);
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$this->assertEquals('qwerty', $node->getEtag());
@@ -287,7 +287,7 @@ abstract class NodeTest extends \Test\TestCase {
public function testGetMTime() {
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$stat = $this->getFileInfo(array(
'fileid' => 1,
@@ -299,7 +299,7 @@ abstract class NodeTest extends \Test\TestCase {
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($stat));
+ ->willReturn($stat);
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$this->assertEquals(50, $node->getMTime());
@@ -308,7 +308,7 @@ abstract class NodeTest extends \Test\TestCase {
public function testGetStorage() {
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
/**
* @var \OC\Files\Storage\Storage | \PHPUnit_Framework_MockObject_MockObject $storage
*/
@@ -319,7 +319,7 @@ abstract class NodeTest extends \Test\TestCase {
$this->view->expects($this->once())
->method('resolvePath')
->with('/bar/foo')
- ->will($this->returnValue(array($storage, 'foo')));
+ ->willReturn(array($storage, 'foo'));
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
@@ -329,7 +329,7 @@ abstract class NodeTest extends \Test\TestCase {
public function testGetPath() {
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$this->assertEquals('/bar/foo', $node->getPath());
@@ -338,7 +338,7 @@ abstract class NodeTest extends \Test\TestCase {
public function testGetInternalPath() {
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
/**
* @var \OC\Files\Storage\Storage | \PHPUnit_Framework_MockObject_MockObject $storage
*/
@@ -349,7 +349,7 @@ abstract class NodeTest extends \Test\TestCase {
$this->view->expects($this->once())
->method('resolvePath')
->with('/bar/foo')
- ->will($this->returnValue(array($storage, 'foo')));
+ ->willReturn(array($storage, 'foo'));
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
@@ -359,7 +359,7 @@ abstract class NodeTest extends \Test\TestCase {
public function testGetName() {
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$this->assertEquals('foo', $node->getName());
@@ -368,17 +368,17 @@ abstract class NodeTest extends \Test\TestCase {
public function testTouchSetMTime() {
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$this->view->expects($this->once())
->method('touch')
->with('/bar/foo', 100)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL)));
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$node->touch(100);
@@ -420,17 +420,17 @@ abstract class NodeTest extends \Test\TestCase {
$this->view->expects($this->once())
->method('touch')
->with('/bar/foo', 100)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->view->expects($this->any())
->method('resolvePath')
->with('/bar/foo')
- ->will($this->returnValue(array(null, 'foo')));
+ ->willReturn(array(null, 'foo'));
$this->view->expects($this->any())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL)));
$node = $this->createTestNode($root, $this->view, '/bar/foo');
$node->touch(100);
@@ -443,12 +443,12 @@ abstract class NodeTest extends \Test\TestCase {
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$this->view->expects($this->any())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ)));
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$node->touch(100);
@@ -466,11 +466,11 @@ abstract class NodeTest extends \Test\TestCase {
$this->view->expects($this->any())
->method('copy')
->with('/bar/foo', '/bar/asd')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->view->expects($this->any())
->method('getFileInfo')
- ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 3])));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 3]));
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$parentNode = new \OC\Files\Node\Folder($this->root, $this->view, '/bar');
@@ -478,10 +478,10 @@ abstract class NodeTest extends \Test\TestCase {
$this->root->expects($this->exactly(2))
->method('get')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['/bar/asd', $newNode],
['/bar', $parentNode]
- ]));
+ ]);
$target = $node->copy('/bar/asd');
$this->assertInstanceOf($this->getNodeClass(), $target);
@@ -505,16 +505,16 @@ abstract class NodeTest extends \Test\TestCase {
$this->view->expects($this->any())
->method('getFileInfo')
- ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ, 'fileid' => 3])));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ, 'fileid' => 3]));
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$parentNode = new \OC\Files\Node\Folder($this->root, $this->view, '/bar');
$this->root->expects($this->once())
->method('get')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['/bar', $parentNode]
- ]));
+ ]);
$node->copy('/bar/asd');
}
@@ -548,9 +548,9 @@ abstract class NodeTest extends \Test\TestCase {
$this->root->expects($this->once())
->method('get')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['/bar', $parentNode]
- ]));
+ ]);
$node->copy('/bar/asd');
}
@@ -559,18 +559,18 @@ abstract class NodeTest extends \Test\TestCase {
$this->view->expects($this->any())
->method('rename')
->with('/bar/foo', '/bar/asd')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->view->expects($this->any())
->method('getFileInfo')
- ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1])));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1]));
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$parentNode = new \OC\Files\Node\Folder($this->root, $this->view, '/bar');
$this->root->expects($this->any())
->method('get')
- ->will($this->returnValueMap([['/bar', $parentNode], ['/bar/asd', $node]]));
+ ->willReturnMap([['/bar', $parentNode], ['/bar/asd', $node]]);
$target = $node->move('/bar/asd');
$this->assertInstanceOf($this->getNodeClass(), $target);
@@ -602,11 +602,11 @@ abstract class NodeTest extends \Test\TestCase {
$this->view->expects($this->any())
->method($viewMethod)
->with('/bar/foo', '/bar/asd')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->view->expects($this->any())
->method('getFileInfo')
- ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1])));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1]));
/**
* @var \OC\Files\Node\File|\PHPUnit_Framework_MockObject_MockObject $node
@@ -617,7 +617,7 @@ abstract class NodeTest extends \Test\TestCase {
$root->expects($this->any())
->method('get')
- ->will($this->returnValueMap([['/bar', $parentNode], ['/bar/asd', $targetTestNode]]));
+ ->willReturnMap([['/bar', $parentNode], ['/bar/asd', $targetTestNode]]);
$hooksRun = 0;
@@ -665,7 +665,7 @@ abstract class NodeTest extends \Test\TestCase {
$this->view->expects($this->any())
->method('getFileInfo')
- ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ])));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ]));
$this->view->expects($this->never())
->method('rename');
@@ -676,7 +676,7 @@ abstract class NodeTest extends \Test\TestCase {
$this->root->expects($this->once())
->method('get')
->with('/bar')
- ->will($this->returnValue($parentNode));
+ ->willReturn($parentNode);
$node->move('/bar/asd');
}
@@ -716,7 +716,7 @@ abstract class NodeTest extends \Test\TestCase {
$this->root->expects($this->once())
->method('get')
->with('/bar')
- ->will($this->returnValue($parentNode));
+ ->willReturn($parentNode);
$node->move('/bar/asd');
}
@@ -728,18 +728,18 @@ abstract class NodeTest extends \Test\TestCase {
$this->view->expects($this->any())
->method('rename')
->with('/bar/foo', '/bar/asd')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->view->expects($this->any())
->method('getFileInfo')
- ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1])));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1]));
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$parentNode = new \OC\Files\Node\Folder($this->root, $this->view, '/bar');
$this->root->expects($this->any())
->method('get')
- ->will($this->returnValueMap([['/bar', $parentNode], ['/bar/asd', $node]]));
+ ->willReturnMap([['/bar', $parentNode], ['/bar/asd', $node]]);
$node->move('/bar/asd');
}
@@ -751,18 +751,18 @@ abstract class NodeTest extends \Test\TestCase {
$this->view->expects($this->any())
->method('copy')
->with('/bar/foo', '/bar/asd')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->view->expects($this->any())
->method('getFileInfo')
- ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1])));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1]));
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$parentNode = new \OC\Files\Node\Folder($this->root, $this->view, '/bar');
$this->root->expects($this->any())
->method('get')
- ->will($this->returnValueMap([['/bar', $parentNode], ['/bar/asd', $node]]));
+ ->willReturnMap([['/bar', $parentNode], ['/bar/asd', $node]]);
$node->copy('/bar/asd');
}
diff --git a/tests/lib/Files/Node/RootTest.php b/tests/lib/Files/Node/RootTest.php
index 5067236ec58..6c4189bdec7 100644
--- a/tests/lib/Files/Node/RootTest.php
+++ b/tests/lib/Files/Node/RootTest.php
@@ -79,7 +79,7 @@ class RootTest extends \Test\TestCase {
$view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('fileid' => 10, 'path' => 'bar/foo', 'name', 'mimetype' => 'text/plain'))));
+ ->willReturn($this->getFileInfo(array('fileid' => 10, 'path' => 'bar/foo', 'name', 'mimetype' => 'text/plain')));
$root->mount($storage, '');
$node = $root->get('/bar/foo');
@@ -115,7 +115,7 @@ class RootTest extends \Test\TestCase {
$view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$root->mount($storage, '');
$root->get('/bar/foo');
diff --git a/tests/lib/Files/Storage/Wrapper/QuotaTest.php b/tests/lib/Files/Storage/Wrapper/QuotaTest.php
index 0061ca3910e..164541b670c 100644
--- a/tests/lib/Files/Storage/Wrapper/QuotaTest.php
+++ b/tests/lib/Files/Storage/Wrapper/QuotaTest.php
@@ -82,7 +82,7 @@ class QuotaTest extends \Test\Files\Storage\Storage {
->getMock();
$storage->expects($this->any())
->method('free_space')
- ->will($this->returnValue(-2));
+ ->willReturn(-2);
$storage->getScanner()->scan('');
$instance = new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => 9));
@@ -138,7 +138,7 @@ class QuotaTest extends \Test\Files\Storage\Storage {
->getMock();
$failStorage->expects($this->any())
->method('fopen')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$instance = new \OC\Files\Storage\Wrapper\Quota(array('storage' => $failStorage, 'quota' => 1000));
@@ -189,14 +189,14 @@ class QuotaTest extends \Test\Files\Storage\Storage {
$cache = $this->getMockBuilder('\OC\Files\Cache\Cache')->disableOriginalConstructor()->getMock();
$storage->expects($this->once())
->method('getCache')
- ->will($this->returnValue($cache));
+ ->willReturn($cache);
$storage->expects($this->once())
->method('free_space')
- ->will($this->returnValue(2048));
+ ->willReturn(2048);
$cache->expects($this->once())
->method('get')
->with('files')
- ->will($this->returnValue(new CacheEntry(['size' => 50])));
+ ->willReturn(new CacheEntry(['size' => 50]));
$instance = new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => 1024, 'root' => 'files'));
diff --git a/tests/lib/Files/Stream/EncryptionTest.php b/tests/lib/Files/Stream/EncryptionTest.php
index e2213365d5f..e55dae98cb6 100644
--- a/tests/lib/Files/Stream/EncryptionTest.php
+++ b/tests/lib/Files/Stream/EncryptionTest.php
@@ -99,10 +99,10 @@ class EncryptionTest extends \Test\TestCase {
$fileMock->expects($this->never())->method('getAccessList');
} else {
$fileMock->expects($this->once())->method('getAccessList')
- ->will($this->returnCallback(function ($sharePath) use ($expectedSharePath) {
+ ->willReturnCallback(function ($sharePath) use ($expectedSharePath) {
$this->assertSame($expectedSharePath, $sharePath);
return array();
- }));
+ });
}
$utilMock = $this->getMockBuilder('\OC\Encryption\Util')
->disableOriginalConstructor()->getMock();
diff --git a/tests/lib/Files/Type/DetectionTest.php b/tests/lib/Files/Type/DetectionTest.php
index 01f11bf39c8..3befe64c825 100644
--- a/tests/lib/Files/Type/DetectionTest.php
+++ b/tests/lib/Files/Type/DetectionTest.php
@@ -240,14 +240,14 @@ class DetectionTest extends \Test\TestCase {
[$this->equalTo('core'), $this->equalTo('filetypes/my-type.png')],
[$this->equalTo('core'), $this->equalTo('filetypes/my.png')]
)
- ->will($this->returnCallback(
+ ->willReturnCallback(
function($appName, $file) {
if ($file === 'filetypes/my.png') {
return 'my.svg';
}
throw new \RuntimeException();
}
- ));
+ );
$detection = new Detection($urlGenerator, $logger, $confDir->url(), $confDir->url());
$mimeType = $detection->mimeTypeIcon('my-type');
@@ -271,14 +271,14 @@ class DetectionTest extends \Test\TestCase {
[$this->equalTo('core'), $this->equalTo('filetypes/foo.png')],
[$this->equalTo('core'), $this->equalTo('filetypes/file.png')]
)
- ->will($this->returnCallback(
+ ->willReturnCallback(
function($appName, $file) {
if ($file === 'filetypes/file.png') {
return 'file.svg';
}
throw new \RuntimeException();
}
- ));
+ );
$detection = new Detection($urlGenerator, $logger, $confDir->url(), $confDir->url());
$mimeType = $detection->mimeTypeIcon('foo-bar');
diff --git a/tests/lib/Files/Utils/ScannerTest.php b/tests/lib/Files/Utils/ScannerTest.php
index 44422cd97d1..9d82e4ae1e1 100644
--- a/tests/lib/Files/Utils/ScannerTest.php
+++ b/tests/lib/Files/Utils/ScannerTest.php
@@ -117,13 +117,13 @@ class ScannerTest extends \Test\TestCase {
$mountProvider->expects($this->any())
->method('getMountsForUser')
- ->will($this->returnCallback(function (IUser $user, IStorageFactory $storageFactory) use ($mount, $uid) {
+ ->willReturnCallback(function (IUser $user, IStorageFactory $storageFactory) use ($mount, $uid) {
if ($user->getUID() === $uid) {
return [$mount];
} else {
return [];
}
- }));
+ });
\OC::$server->getMountProviderCollection()->registerProvider($mountProvider);
$cache = $storage->getCache();
@@ -199,9 +199,9 @@ class ScannerTest extends \Test\TestCase {
$sharedStorage->expects($this->any())
->method('instanceOfStorage')
- ->will($this->returnValueMap([
+ ->willReturnMap([
[SharedStorage::class, true],
- ]));
+ ]);
$sharedStorage->expects($this->never())
->method('getScanner');
diff --git a/tests/lib/Files/ViewTest.php b/tests/lib/Files/ViewTest.php
index 57050059375..5f3116e7b24 100644
--- a/tests/lib/Files/ViewTest.php
+++ b/tests/lib/Files/ViewTest.php
@@ -1169,11 +1169,11 @@ class ViewTest extends \Test\TestCase {
$storage2->expects($this->any())
->method('fopen')
- ->will($this->returnCallback(function ($path, $mode) use ($storage2) {
+ ->willReturnCallback(function ($path, $mode) use ($storage2) {
/** @var \PHPUnit_Framework_MockObject_MockObject | \OC\Files\Storage\Temporary $storage2 */
$source = fopen($storage2->getSourcePath($path), $mode);
return Quota::wrap($source, 9);
- }));
+ });
$storage1->mkdir('sub');
$storage1->file_put_contents('foo.txt', '0123456789ABCDEFGH');
@@ -1220,7 +1220,7 @@ class ViewTest extends \Test\TestCase {
->getMock();
$storage->expects($this->once())
->method('unlink')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$scanner = $storage->getScanner();
$cache = $storage->getCache();
$storage->file_put_contents('foo.txt', 'asd');
@@ -1597,7 +1597,7 @@ class ViewTest extends \Test\TestCase {
$mountProvider = $this->createMock(IMountProvider::class);
$mountProvider->expects($this->any())
->method('getMountsForUser')
- ->will($this->returnValue($mounts));
+ ->willReturn($mounts);
$mountProviderCollection = \OC::$server->getMountProviderCollection();
$mountProviderCollection->registerProvider($mountProvider);
@@ -1617,11 +1617,11 @@ class ViewTest extends \Test\TestCase {
]);
$mount1->expects($this->once())
->method('moveMount')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$mount2->expects($this->once())
->method('moveMount')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$view = new View('/' . $this->user . '/files/');
$view->mkdir('sub');
@@ -1846,13 +1846,13 @@ class ViewTest extends \Test\TestCase {
$storage->expects($this->once())
->method($operation)
- ->will($this->returnCallback(
+ ->willReturnCallback(
function () use ($view, $lockedPath, &$lockTypeDuring) {
$lockTypeDuring = $this->getFileLockType($view, $lockedPath);
return true;
}
- ));
+ );
$this->assertNull($this->getFileLockType($view, $lockedPath), 'File not locked before operation');
@@ -1890,13 +1890,13 @@ class ViewTest extends \Test\TestCase {
$storage->expects($this->once())
->method('fopen')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function () use ($view, $path, &$lockTypeDuring) {
$lockTypeDuring = $this->getFileLockType($view, $path);
return fopen('php://temp', 'r+');
}
- ));
+ );
$this->connectMockHooks('write', $view, $path, $lockTypePre, $lockTypePost);
@@ -1929,13 +1929,13 @@ class ViewTest extends \Test\TestCase {
$storage->expects($this->once())
->method('fopen')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function () use ($view, $path, &$lockTypeDuring) {
$lockTypeDuring = $this->getFileLockType($view, $path);
return fopen('php://temp', 'r+');
}
- ));
+ );
$this->connectMockHooks('write', $view, $path, $lockTypePre, $lockTypePost);
@@ -1990,11 +1990,11 @@ class ViewTest extends \Test\TestCase {
$storage->expects($this->once())
->method($operation)
- ->will($this->returnCallback(
+ ->willReturnCallback(
function () {
throw new \Exception('Simulated exception');
}
- ));
+ );
$thrown = false;
try {
@@ -2102,7 +2102,7 @@ class ViewTest extends \Test\TestCase {
$storage->expects($this->any())
->method('filemtime')
- ->will($this->returnValue(123456789));
+ ->willReturn(123456789);
$sourcePath = 'original.txt';
$targetPath = 'target.txt';
@@ -2113,14 +2113,14 @@ class ViewTest extends \Test\TestCase {
$storage->expects($this->once())
->method($operation)
- ->will($this->returnCallback(
+ ->willReturnCallback(
function () use ($view, $sourcePath, $targetPath, &$lockTypeSourceDuring, &$lockTypeTargetDuring) {
$lockTypeSourceDuring = $this->getFileLockType($view, $sourcePath);
$lockTypeTargetDuring = $this->getFileLockType($view, $targetPath);
return true;
}
- ));
+ );
$this->connectMockHooks($operation, $view, $sourcePath, $lockTypeSourcePre, $lockTypeSourcePost);
$this->connectMockHooks($operation, $view, $targetPath, $lockTypeTargetPre, $lockTypeTargetPost);
@@ -2166,11 +2166,11 @@ class ViewTest extends \Test\TestCase {
$storage->expects($this->once())
->method('copy')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function () {
throw new \Exception();
}
- ));
+ );
$this->connectMockHooks('copy', $view, $sourcePath, $lockTypeSourcePre, $lockTypeSourcePost);
$this->connectMockHooks('copy', $view, $targetPath, $lockTypeTargetPre, $lockTypeTargetPost);
@@ -2282,7 +2282,7 @@ class ViewTest extends \Test\TestCase {
$storage2->expects($this->any())
->method('filemtime')
- ->will($this->returnValue(123456789));
+ ->willReturn(123456789);
$sourcePath = 'original.txt';
$targetPath = 'substorage/target.txt';
@@ -2296,14 +2296,14 @@ class ViewTest extends \Test\TestCase {
->method($storageOperation);
$storage2->expects($this->once())
->method($storageOperation)
- ->will($this->returnCallback(
+ ->willReturnCallback(
function () use ($view, $sourcePath, $targetPath, &$lockTypeSourceDuring, &$lockTypeTargetDuring) {
$lockTypeSourceDuring = $this->getFileLockType($view, $sourcePath);
$lockTypeTargetDuring = $this->getFileLockType($view, $targetPath);
return true;
}
- ));
+ );
$this->connectMockHooks($viewOperation, $view, $sourcePath, $lockTypeSourcePre, $lockTypeSourcePost);
$this->connectMockHooks($viewOperation, $view, $targetPath, $lockTypeTargetPre, $lockTypeTargetPost);
@@ -2343,7 +2343,7 @@ class ViewTest extends \Test\TestCase {
$mount->expects($this->once())
->method('moveMount')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function ($target) use ($mount, $view, $sourcePath, $targetPath, &$lockTypeSourceDuring, &$lockTypeTargetDuring, &$lockTypeSharedRootDuring) {
$lockTypeSourceDuring = $this->getFileLockType($view, $sourcePath, true);
$lockTypeTargetDuring = $this->getFileLockType($view, $targetPath, true);
@@ -2354,7 +2354,7 @@ class ViewTest extends \Test\TestCase {
return true;
}
- ));
+ );
$this->connectMockHooks('rename', $view, $sourcePath, $lockTypeSourcePre, $lockTypeSourcePost, true);
$this->connectMockHooks('rename', $view, $targetPath, $lockTypeTargetPre, $lockTypeTargetPost, true);
@@ -2408,18 +2408,18 @@ class ViewTest extends \Test\TestCase {
$eventHandler->expects($this->any())
->method('preCallback')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function () use ($view, $path, $onMountPoint, &$lockTypePre) {
$lockTypePre = $this->getFileLockType($view, $path, $onMountPoint);
}
- ));
+ );
$eventHandler->expects($this->any())
->method('postCallback')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function () use ($view, $path, $onMountPoint, &$lockTypePost) {
$lockTypePost = $this->getFileLockType($view, $path, $onMountPoint);
}
- ));
+ );
if ($hookType !== null) {
Util::connectHook(