From f984512e334373c9689c1093f10927a120aeffbc Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 18 Feb 2020 17:58:16 +0100 Subject: [PATCH] fix tests Signed-off-by: Robin Appelman --- tests/lib/Files/ViewTest.php | 32 ++++++++++++++++++++++++++------ 1 file 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,9 +2098,18 @@ 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,9 +2287,18 @@ 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('.'); -- 2.39.5