[Pkg-owncloud-commits] [owncloud] 07/63: Add unit test for searching in storage root (cherry picked from commit e28a2ff)
David Prévot
taffit at moszumanska.debian.org
Tue Dec 22 16:50:46 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch stable8.0
in repository owncloud.
commit 345660b4079f65832d59603f4ddd46638bd4511a
Author: Robin Appelman <icewind at owncloud.com>
Date: Tue Oct 6 15:02:33 2015 +0200
Add unit test for searching in storage root
(cherry picked from commit e28a2ff)
---
tests/lib/files/node/folder.php | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/tests/lib/files/node/folder.php b/tests/lib/files/node/folder.php
index 4a88e2a..eacd2b9 100644
--- a/tests/lib/files/node/folder.php
+++ b/tests/lib/files/node/folder.php
@@ -444,6 +444,45 @@ class Folder extends \Test\TestCase {
$this->assertEquals('/foo', $result[0]->getPath());
}
+ public function testSearchInStorageRoot() {
+ $manager = $this->getMock('\OC\Files\Mount\Manager');
+ /**
+ * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
+ */
+ $view = $this->getMock('\OC\Files\View');
+ $root = $this->getMock('\OC\Files\Node\Root', array(), array($manager, $view, $this->user));
+ $root->expects($this->any())
+ ->method('getUser')
+ ->will($this->returnValue($this->user));
+ $storage = $this->getMock('\OC\Files\Storage\Storage');
+ $cache = $this->getMock('\OC\Files\Cache\Cache', array(), array(''));
+
+ $storage->expects($this->once())
+ ->method('getCache')
+ ->will($this->returnValue($cache));
+
+ $cache->expects($this->once())
+ ->method('search')
+ ->with('%qw%')
+ ->will($this->returnValue(array(
+ array('fileid' => 3, 'path' => 'foo/qwerty', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain')
+ )));
+
+ $root->expects($this->once())
+ ->method('getMountsIn')
+ ->with('/bar')
+ ->will($this->returnValue(array()));
+
+ $view->expects($this->once())
+ ->method('resolvePath')
+ ->will($this->returnValue(array($storage, '')));
+
+ $node = new \OC\Files\Node\Folder($root, $view, '/bar');
+ $result = $node->search('qw');
+ $this->assertEquals(1, count($result));
+ $this->assertEquals('/bar/foo/qwerty', $result[0]->getPath());
+ }
+
public function testSearchByTag() {
$manager = $this->getMock('\OC\Files\Mount\Manager');
/**
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list