pass the fileinfo to the node if available
This commit is contained in:
parent
a98b038300
commit
5e6c905a14
|
@ -100,9 +100,9 @@ class Folder extends Node implements \OCP\Files\Folder {
|
|||
$isDir = $info['mimetype'] === 'httpd/unix-directory';
|
||||
}
|
||||
if ($isDir) {
|
||||
return new Folder($this->root, $this->view, $path);
|
||||
return new Folder($this->root, $this->view, $path, $info);
|
||||
} else {
|
||||
return new File($this->root, $this->view, $path);
|
||||
return new File($this->root, $this->view, $path, $info);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -601,8 +601,8 @@ class Folder extends \Test\TestCase {
|
|||
$cache = $this->getMock('\OC\Files\Cache\Cache', array(), array(''));
|
||||
|
||||
$view->expects($this->once())
|
||||
->method('file_exists')
|
||||
->will($this->returnValue(true));
|
||||
->method('getFileInfo')
|
||||
->will($this->returnValue(new FileInfo('/bar/foo/qwerty', null, 'qwerty', [], null)));
|
||||
|
||||
$storage->expects($this->once())
|
||||
->method('getCache')
|
||||
|
@ -683,8 +683,8 @@ class Folder extends \Test\TestCase {
|
|||
$cache = $this->getMock('\OC\Files\Cache\Cache', array(), array(''));
|
||||
|
||||
$view->expects($this->any())
|
||||
->method('file_exists')
|
||||
->will($this->returnValue(true));
|
||||
->method('getFileInfo')
|
||||
->will($this->returnValue(new FileInfo('/bar/foo/qwerty', null, 'qwerty', [], null)));
|
||||
|
||||
$storage->expects($this->any())
|
||||
->method('getCache')
|
||||
|
|
|
@ -12,6 +12,9 @@ use OC\Files\FileInfo;
|
|||
use OCP\Files\NotPermittedException;
|
||||
use OC\Files\Mount\Manager;
|
||||
|
||||
/**
|
||||
* @group DB
|
||||
*/
|
||||
class Root extends \Test\TestCase {
|
||||
private $user;
|
||||
|
||||
|
@ -41,16 +44,6 @@ class Root extends \Test\TestCase {
|
|||
->with('/bar/foo')
|
||||
->will($this->returnValue($this->getFileInfo(array('fileid' => 10, 'path' => 'bar/foo', 'name', 'mimetype' => 'text/plain'))));
|
||||
|
||||
$view->expects($this->once())
|
||||
->method('is_dir')
|
||||
->with('/bar/foo')
|
||||
->will($this->returnValue(false));
|
||||
|
||||
$view->expects($this->once())
|
||||
->method('file_exists')
|
||||
->with('/bar/foo')
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$root->mount($storage, '');
|
||||
$node = $root->get('/bar/foo');
|
||||
$this->assertEquals(10, $node->getId());
|
||||
|
@ -73,7 +66,7 @@ class Root extends \Test\TestCase {
|
|||
$root = new \OC\Files\Node\Root($manager, $view, $this->user);
|
||||
|
||||
$view->expects($this->once())
|
||||
->method('file_exists')
|
||||
->method('getFileInfo')
|
||||
->with('/bar/foo')
|
||||
->will($this->returnValue(false));
|
||||
|
||||
|
|
Loading…
Reference in New Issue