fix tests

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2020-02-18 17:58:16 +01:00
parent 5199f80196
commit f984512e33
No known key found for this signature in database
GPG Key ID: 42B69D8A64526EFB
1 changed files with 26 additions and 6 deletions

View File

@ -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('.');