aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Files/Node
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/Files/Node')
-rw-r--r--tests/lib/Files/Node/FileTest.php20
-rw-r--r--tests/lib/Files/Node/FolderTest.php58
-rw-r--r--tests/lib/Files/Node/IntegrationTest.php4
-rw-r--r--tests/lib/Files/Node/NodeTest.php32
-rw-r--r--tests/lib/Files/Node/RootTest.php2
5 files changed, 58 insertions, 58 deletions
diff --git a/tests/lib/Files/Node/FileTest.php b/tests/lib/Files/Node/FileTest.php
index 69d31b28a96..c6f468b796b 100644
--- a/tests/lib/Files/Node/FileTest.php
+++ b/tests/lib/Files/Node/FileTest.php
@@ -53,7 +53,7 @@ class FileTest extends NodeTest {
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ)));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ]));
$node = new \OC\Files\Node\File($root, $this->view, '/bar/foo');
$this->assertEquals('bar', $node->getContent());
@@ -75,7 +75,7 @@ class FileTest extends NodeTest {
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->willReturn($this->getFileInfo(array('permissions' => 0)));
+ ->willReturn($this->getFileInfo(['permissions' => 0]));
$node = new \OC\Files\Node\File($root, $this->view, '/bar/foo');
$node->getContent();
@@ -94,7 +94,7 @@ class FileTest extends NodeTest {
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL)));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL]));
$this->view->expects($this->once())
->method('file_put_contents')
@@ -117,7 +117,7 @@ class FileTest extends NodeTest {
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ)));
+ ->willReturn($this->getFileInfo(['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')
- ->willReturn($this->getFileInfo(array('mimetype' => 'text/plain')));
+ ->willReturn($this->getFileInfo(['mimetype' => 'text/plain']));
$node = new \OC\Files\Node\File($root, $this->view, '/bar/foo');
$this->assertEquals('text/plain', $node->getMimeType());
@@ -167,7 +167,7 @@ class FileTest extends NodeTest {
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL)));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL]));
$node = new \OC\Files\Node\File($root, $this->view, '/bar/foo');
$fh = $node->fopen('r');
@@ -202,7 +202,7 @@ class FileTest extends NodeTest {
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL)));
+ ->willReturn($this->getFileInfo(['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')
- ->willReturn($this->getFileInfo(array('permissions' => 0)));
+ ->willReturn($this->getFileInfo(['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')
- ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_UPDATE)));
+ ->willReturn($this->getFileInfo(['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')
- ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ)));
+ ->willReturn($this->getFileInfo(['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 979c7fd6da6..83ebc478370 100644
--- a/tests/lib/Files/Node/FolderTest.php
+++ b/tests/lib/Files/Node/FolderTest.php
@@ -64,10 +64,10 @@ class FolderTest extends NodeTest {
$view->expects($this->any())
->method('getDirectoryContent')
->with('/bar/foo')
- ->willReturn(array(
+ ->willReturn([
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();
@@ -163,7 +163,7 @@ class FolderTest extends NodeTest {
$view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL)));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL]));
$view->expects($this->once())
->method('mkdir')
@@ -195,7 +195,7 @@ class FolderTest extends NodeTest {
$view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ)));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ]));
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$node->newFolder('asd');
@@ -217,7 +217,7 @@ class FolderTest extends NodeTest {
$view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL)));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL]));
$view->expects($this->once())
->method('touch')
@@ -249,7 +249,7 @@ class FolderTest extends NodeTest {
$view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ)));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ]));
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$node->newFile('asd');
@@ -308,14 +308,14 @@ class FolderTest extends NodeTest {
$cache->expects($this->once())
->method('search')
->with('%qw%')
- ->willReturn(array(
- array('fileid' => 3, 'path' => 'foo/qwerty', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain')
- ));
+ ->willReturn([
+ ['fileid' => 3, 'path' => 'foo/qwerty', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain']
+ ]);
$root->expects($this->once())
->method('getMountsIn')
->with('/bar/foo')
- ->willReturn(array());
+ ->willReturn([]);
$root->expects($this->once())
->method('getMount')
@@ -361,15 +361,15 @@ class FolderTest extends NodeTest {
$cache->expects($this->once())
->method('search')
->with('%qw%')
- ->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'),
- ));
+ ->willReturn([
+ ['fileid' => 3, 'path' => 'files/foo', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain'],
+ ['fileid' => 3, 'path' => 'files_trashbin/foo2.d12345', 'name' => 'foo2.d12345', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain'],
+ ]);
$root->expects($this->once())
->method('getMountsIn')
->with('')
- ->willReturn(array());
+ ->willReturn([]);
$root->expects($this->once())
->method('getMount')
@@ -412,14 +412,14 @@ class FolderTest extends NodeTest {
$cache->expects($this->once())
->method('search')
->with('%qw%')
- ->willReturn(array(
- array('fileid' => 3, 'path' => 'foo/qwerty', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain')
- ));
+ ->willReturn([
+ ['fileid' => 3, 'path' => 'foo/qwerty', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain']
+ ]);
$root->expects($this->once())
->method('getMountsIn')
->with('/bar')
- ->willReturn(array());
+ ->willReturn([]);
$root->expects($this->once())
->method('getMount')
@@ -478,21 +478,21 @@ class FolderTest extends NodeTest {
$cache->expects($this->once())
->method('search')
->with('%qw%')
- ->willReturn(array(
- array('fileid' => 3, 'path' => 'foo/qwerty', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain')
- ));
+ ->willReturn([
+ ['fileid' => 3, 'path' => 'foo/qwerty', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain']
+ ]);
$subCache->expects($this->once())
->method('search')
->with('%qw%')
- ->willReturn(array(
- array('fileid' => 4, 'path' => 'asd/qweasd', 'name' => 'qweasd', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain')
- ));
+ ->willReturn([
+ ['fileid' => 4, 'path' => 'asd/qweasd', 'name' => 'qweasd', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain']
+ ]);
$root->expects($this->once())
->method('getMountsIn')
->with('/bar/foo')
- ->willReturn(array($subMount));
+ ->willReturn([$subMount]);
$root->expects($this->once())
->method('getMount')
@@ -556,7 +556,7 @@ class FolderTest extends NodeTest {
$root->expects($this->once())
->method('getMountsIn')
->with('/bar/foo')
- ->willReturn(array());
+ ->willReturn([]);
$root->expects($this->once())
->method('getMount')
@@ -659,7 +659,7 @@ class FolderTest extends NodeTest {
$root->expects($this->once())
->method('getMountsIn')
->with('/bar/foo')
- ->willReturn(array());
+ ->willReturn([]);
$root->expects($this->once())
->method('getMount')
@@ -727,7 +727,7 @@ class FolderTest extends NodeTest {
$root->expects($this->any())
->method('getMountsIn')
->with('/bar/foo')
- ->willReturn(array($mount2));
+ ->willReturn([$mount2]);
$root->expects($this->once())
->method('getMount')
diff --git a/tests/lib/Files/Node/IntegrationTest.php b/tests/lib/Files/Node/IntegrationTest.php
index 2a542a1097a..26cdf398d94 100644
--- a/tests/lib/Files/Node/IntegrationTest.php
+++ b/tests/lib/Files/Node/IntegrationTest.php
@@ -57,8 +57,8 @@ class IntegrationTest extends \Test\TestCase {
$this->createMock(ILogger::class),
$this->createMock(IUserManager::class)
);
- $storage = new Temporary(array());
- $subStorage = new Temporary(array());
+ $storage = new Temporary([]);
+ $subStorage = new Temporary([]);
$this->storages[] = $storage;
$this->storages[] = $subStorage;
$this->root->mount($storage, '/');
diff --git a/tests/lib/Files/Node/NodeTest.php b/tests/lib/Files/Node/NodeTest.php
index 18cc4d80574..b963a395560 100644
--- a/tests/lib/Files/Node/NodeTest.php
+++ b/tests/lib/Files/Node/NodeTest.php
@@ -203,13 +203,13 @@ abstract class NodeTest extends \Test\TestCase {
->method('getUser')
->willReturn($this->user);
- $stat = array(
+ $stat = [
'fileid' => 1,
'size' => 100,
'etag' => 'qwerty',
'mtime' => 50,
'permissions' => 0
- );
+ ];
$this->view->expects($this->once())
->method('stat')
@@ -225,12 +225,12 @@ abstract class NodeTest extends \Test\TestCase {
->method('getUser')
->willReturn($this->user);
- $stat = $this->getFileInfo(array(
+ $stat = $this->getFileInfo([
'fileid' => 1,
'size' => 100,
'etag' => 'qwerty',
'mtime' => 50
- ));
+ ]);
$this->view->expects($this->once())
->method('getFileInfo')
@@ -247,12 +247,12 @@ abstract class NodeTest extends \Test\TestCase {
->willReturn($this->user);
- $stat = $this->getFileInfo(array(
+ $stat = $this->getFileInfo([
'fileid' => 1,
'size' => 100,
'etag' => 'qwerty',
'mtime' => 50
- ));
+ ]);
$this->view->expects($this->once())
->method('getFileInfo')
@@ -268,12 +268,12 @@ abstract class NodeTest extends \Test\TestCase {
->method('getUser')
->willReturn($this->user);
- $stat = $this->getFileInfo(array(
+ $stat = $this->getFileInfo([
'fileid' => 1,
'size' => 100,
'etag' => 'qwerty',
'mtime' => 50
- ));
+ ]);
$this->view->expects($this->once())
->method('getFileInfo')
@@ -289,12 +289,12 @@ abstract class NodeTest extends \Test\TestCase {
->method('getUser')
->willReturn($this->user);
- $stat = $this->getFileInfo(array(
+ $stat = $this->getFileInfo([
'fileid' => 1,
'size' => 100,
'etag' => 'qwerty',
'mtime' => 50
- ));
+ ]);
$this->view->expects($this->once())
->method('getFileInfo')
@@ -319,7 +319,7 @@ abstract class NodeTest extends \Test\TestCase {
$this->view->expects($this->once())
->method('resolvePath')
->with('/bar/foo')
- ->willReturn(array($storage, 'foo'));
+ ->willReturn([$storage, 'foo']);
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
@@ -349,7 +349,7 @@ abstract class NodeTest extends \Test\TestCase {
$this->view->expects($this->once())
->method('resolvePath')
->with('/bar/foo')
- ->willReturn(array($storage, 'foo'));
+ ->willReturn([$storage, 'foo']);
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
@@ -378,7 +378,7 @@ abstract class NodeTest extends \Test\TestCase {
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL)));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL]));
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$node->touch(100);
@@ -425,12 +425,12 @@ abstract class NodeTest extends \Test\TestCase {
$this->view->expects($this->any())
->method('resolvePath')
->with('/bar/foo')
- ->willReturn(array(null, 'foo'));
+ ->willReturn([null, 'foo']);
$this->view->expects($this->any())
->method('getFileInfo')
->with('/bar/foo')
- ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL)));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL]));
$node = $this->createTestNode($root, $this->view, '/bar/foo');
$node->touch(100);
@@ -448,7 +448,7 @@ abstract class NodeTest extends \Test\TestCase {
$this->view->expects($this->any())
->method('getFileInfo')
->with('/bar/foo')
- ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ)));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ]));
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$node->touch(100);
diff --git a/tests/lib/Files/Node/RootTest.php b/tests/lib/Files/Node/RootTest.php
index 6c4189bdec7..c78bef07627 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')
- ->willReturn($this->getFileInfo(array('fileid' => 10, 'path' => 'bar/foo', 'name', 'mimetype' => 'text/plain')));
+ ->willReturn($this->getFileInfo(['fileid' => 10, 'path' => 'bar/foo', 'name', 'mimetype' => 'text/plain']));
$root->mount($storage, '');
$node = $root->get('/bar/foo');