summaryrefslogtreecommitdiffstats
path: root/tests/lib/Files/Node
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2020-03-25 22:21:27 +0100
committerChristoph Wurst <christoph@winzerhof-wurst.at>2020-03-25 22:21:27 +0100
commit2ee65f177e4f7e09ad2287f14d564e7068d322fb (patch)
tree39075e87ea7927e20e8956824cb7c49bf626b178 /tests/lib/Files/Node
parent3cf321fdfc4235a87015a9af2f59c63220016c65 (diff)
downloadnextcloud-server-2ee65f177e4f7e09ad2287f14d564e7068d322fb.tar.gz
nextcloud-server-2ee65f177e4f7e09ad2287f14d564e7068d322fb.zip
Use the shorter phpunit syntax for mocked return values
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'tests/lib/Files/Node')
-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
4 files changed, 161 insertions, 161 deletions
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');