fix tests
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
5199f80196
commit
f984512e33
|
@ -15,6 +15,7 @@ use OC\Files\Storage\Common;
|
||||||
use OC\Files\Storage\Temporary;
|
use OC\Files\Storage\Temporary;
|
||||||
use OC\Files\Stream\Quota;
|
use OC\Files\Stream\Quota;
|
||||||
use OC\Files\View;
|
use OC\Files\View;
|
||||||
|
use OCP\Constants;
|
||||||
use OCP\Files\Config\IMountProvider;
|
use OCP\Files\Config\IMountProvider;
|
||||||
use OCP\Files\FileInfo;
|
use OCP\Files\FileInfo;
|
||||||
use OCP\Files\Storage\IStorage;
|
use OCP\Files\Storage\IStorage;
|
||||||
|
@ -1611,7 +1612,7 @@ class ViewTest extends \Test\TestCase {
|
||||||
public function testMountPointMove() {
|
public function testMountPointMove() {
|
||||||
self::loginAsUser($this->user);
|
self::loginAsUser($this->user);
|
||||||
|
|
||||||
list($mount1, $mount2) = $this->createTestMovableMountPoints([
|
[$mount1, $mount2] = $this->createTestMovableMountPoints([
|
||||||
$this->user . '/files/mount1',
|
$this->user . '/files/mount1',
|
||||||
$this->user . '/files/mount2',
|
$this->user . '/files/mount2',
|
||||||
]);
|
]);
|
||||||
|
@ -1636,7 +1637,7 @@ class ViewTest extends \Test\TestCase {
|
||||||
public function testMoveMountPointIntoAnother() {
|
public function testMoveMountPointIntoAnother() {
|
||||||
self::loginAsUser($this->user);
|
self::loginAsUser($this->user);
|
||||||
|
|
||||||
list($mount1, $mount2) = $this->createTestMovableMountPoints([
|
[$mount1, $mount2] = $this->createTestMovableMountPoints([
|
||||||
$this->user . '/files/mount1',
|
$this->user . '/files/mount1',
|
||||||
$this->user . '/files/mount2',
|
$this->user . '/files/mount2',
|
||||||
]);
|
]);
|
||||||
|
@ -1659,7 +1660,7 @@ class ViewTest extends \Test\TestCase {
|
||||||
public function testMoveMountPointIntoSharedFolder() {
|
public function testMoveMountPointIntoSharedFolder() {
|
||||||
self::loginAsUser($this->user);
|
self::loginAsUser($this->user);
|
||||||
|
|
||||||
list($mount1) = $this->createTestMovableMountPoints([
|
[$mount1] = $this->createTestMovableMountPoints([
|
||||||
$this->user . '/files/mount1',
|
$this->user . '/files/mount1',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -2097,9 +2098,18 @@ class ViewTest extends \Test\TestCase {
|
||||||
|
|
||||||
/** @var Temporary|\PHPUnit_Framework_MockObject_MockObject $storage */
|
/** @var Temporary|\PHPUnit_Framework_MockObject_MockObject $storage */
|
||||||
$storage = $this->getMockBuilder(Temporary::class)
|
$storage = $this->getMockBuilder(Temporary::class)
|
||||||
->setMethods([$operation, 'filemtime'])
|
->setMethods([$operation, 'getMetaData', 'filemtime'])
|
||||||
->getMock();
|
->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())
|
$storage->expects($this->any())
|
||||||
->method('filemtime')
|
->method('filemtime')
|
||||||
->willReturn(123456789);
|
->willReturn(123456789);
|
||||||
|
@ -2277,9 +2287,18 @@ class ViewTest extends \Test\TestCase {
|
||||||
->getMock();
|
->getMock();
|
||||||
/** @var Temporary|\PHPUnit_Framework_MockObject_MockObject $storage2 */
|
/** @var Temporary|\PHPUnit_Framework_MockObject_MockObject $storage2 */
|
||||||
$storage2 = $this->getMockBuilder(Temporary::class)
|
$storage2 = $this->getMockBuilder(Temporary::class)
|
||||||
->setMethods([$storageOperation, 'filemtime'])
|
->setMethods([$storageOperation, 'getMetaData', 'filemtime'])
|
||||||
->getMock();
|
->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())
|
$storage2->expects($this->any())
|
||||||
->method('filemtime')
|
->method('filemtime')
|
||||||
->willReturn(123456789);
|
->willReturn(123456789);
|
||||||
|
@ -2331,7 +2350,7 @@ class ViewTest extends \Test\TestCase {
|
||||||
public function testLockMoveMountPoint() {
|
public function testLockMoveMountPoint() {
|
||||||
self::loginAsUser('test');
|
self::loginAsUser('test');
|
||||||
|
|
||||||
list($mount) = $this->createTestMovableMountPoints([
|
[$mount] = $this->createTestMovableMountPoints([
|
||||||
$this->user . '/files/substorage',
|
$this->user . '/files/substorage',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -2553,6 +2572,7 @@ class ViewTest extends \Test\TestCase {
|
||||||
$fh = tmpfile();
|
$fh = tmpfile();
|
||||||
fwrite($fh, 'fooo');
|
fwrite($fh, 'fooo');
|
||||||
rewind($fh);
|
rewind($fh);
|
||||||
|
clearstatcache();
|
||||||
$view->file_put_contents('', $fh);
|
$view->file_put_contents('', $fh);
|
||||||
$this->assertEquals('fooo', $view->file_get_contents(''));
|
$this->assertEquals('fooo', $view->file_get_contents(''));
|
||||||
$data = $view->getFileInfo('.');
|
$data = $view->getFileInfo('.');
|
||||||
|
|
Loading…
Reference in New Issue