summaryrefslogtreecommitdiffstats
path: root/tests/lib/Files/Node/FolderTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/Files/Node/FolderTest.php')
-rw-r--r--tests/lib/Files/Node/FolderTest.php170
1 files changed, 85 insertions, 85 deletions
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();