summaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2020-02-18 17:58:16 +0100
committerRobin Appelman <robin@icewind.nl>2020-04-01 14:17:31 +0200
commitf984512e334373c9689c1093f10927a120aeffbc (patch)
tree12771587f3002cd401b33b765a2600a99a75995e /tests/lib
parent5199f8019690eeed2db1be69e3cb6d64a4f08357 (diff)
downloadnextcloud-server-f984512e334373c9689c1093f10927a120aeffbc.tar.gz
nextcloud-server-f984512e334373c9689c1093f10927a120aeffbc.zip
fix tests
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/Files/ViewTest.php32
1 files changed, 26 insertions, 6 deletions
diff --git a/tests/lib/Files/ViewTest.php b/tests/lib/Files/ViewTest.php
index 5f3116e7b24..c1da385a3cc 100644
--- a/tests/lib/Files/ViewTest.php
+++ b/tests/lib/Files/ViewTest.php
@@ -15,6 +15,7 @@ use OC\Files\Storage\Common;
use OC\Files\Storage\Temporary;
use OC\Files\Stream\Quota;
use OC\Files\View;
+use OCP\Constants;
use OCP\Files\Config\IMountProvider;
use OCP\Files\FileInfo;
use OCP\Files\Storage\IStorage;
@@ -1611,7 +1612,7 @@ class ViewTest extends \Test\TestCase {
public function testMountPointMove() {
self::loginAsUser($this->user);
- list($mount1, $mount2) = $this->createTestMovableMountPoints([
+ [$mount1, $mount2] = $this->createTestMovableMountPoints([
$this->user . '/files/mount1',
$this->user . '/files/mount2',
]);
@@ -1636,7 +1637,7 @@ class ViewTest extends \Test\TestCase {
public function testMoveMountPointIntoAnother() {
self::loginAsUser($this->user);
- list($mount1, $mount2) = $this->createTestMovableMountPoints([
+ [$mount1, $mount2] = $this->createTestMovableMountPoints([
$this->user . '/files/mount1',
$this->user . '/files/mount2',
]);
@@ -1659,7 +1660,7 @@ class ViewTest extends \Test\TestCase {
public function testMoveMountPointIntoSharedFolder() {
self::loginAsUser($this->user);
- list($mount1) = $this->createTestMovableMountPoints([
+ [$mount1] = $this->createTestMovableMountPoints([
$this->user . '/files/mount1',
]);
@@ -2097,10 +2098,19 @@ class ViewTest extends \Test\TestCase {
/** @var Temporary|\PHPUnit_Framework_MockObject_MockObject $storage */
$storage = $this->getMockBuilder(Temporary::class)
- ->setMethods([$operation, 'filemtime'])
+ ->setMethods([$operation, 'getMetaData', 'filemtime'])
->getMock();
$storage->expects($this->any())
+ ->method('getMetaData')
+ ->will($this->returnValue([
+ 'mtime' => 1885434487,
+ 'etag' => '',
+ 'mimetype' => 'text/plain',
+ 'permissions' => Constants::PERMISSION_ALL,
+ 'size' => 3
+ ]));
+ $storage->expects($this->any())
->method('filemtime')
->willReturn(123456789);
@@ -2277,10 +2287,19 @@ class ViewTest extends \Test\TestCase {
->getMock();
/** @var Temporary|\PHPUnit_Framework_MockObject_MockObject $storage2 */
$storage2 = $this->getMockBuilder(Temporary::class)
- ->setMethods([$storageOperation, 'filemtime'])
+ ->setMethods([$storageOperation, 'getMetaData', 'filemtime'])
->getMock();
$storage2->expects($this->any())
+ ->method('getMetaData')
+ ->will($this->returnValue([
+ 'mtime' => 1885434487,
+ 'etag' => '',
+ 'mimetype' => 'text/plain',
+ 'permissions' => Constants::PERMISSION_ALL,
+ 'size' => 3
+ ]));
+ $storage2->expects($this->any())
->method('filemtime')
->willReturn(123456789);
@@ -2331,7 +2350,7 @@ class ViewTest extends \Test\TestCase {
public function testLockMoveMountPoint() {
self::loginAsUser('test');
- list($mount) = $this->createTestMovableMountPoints([
+ [$mount] = $this->createTestMovableMountPoints([
$this->user . '/files/substorage',
]);
@@ -2553,6 +2572,7 @@ class ViewTest extends \Test\TestCase {
$fh = tmpfile();
fwrite($fh, 'fooo');
rewind($fh);
+ clearstatcache();
$view->file_put_contents('', $fh);
$this->assertEquals('fooo', $view->file_get_contents(''));
$data = $view->getFileInfo('.');