aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Files/Node/RootTest.php
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2016-09-18 18:36:53 +0200
committerRobin Appelman <robin@icewind.nl>2016-10-12 16:12:28 +0200
commit0d842e0550a15b7b6c501dae2ec24a61b72ef8c9 (patch)
tree06c880a305b73d603675b724ae73c944ad484225 /tests/lib/Files/Node/RootTest.php
parentb2d68c00091f8bcba104cabfe0f7e2c78cc7a8d0 (diff)
downloadnextcloud-server-0d842e0550a15b7b6c501dae2ec24a61b72ef8c9.tar.gz
nextcloud-server-0d842e0550a15b7b6c501dae2ec24a61b72ef8c9.zip
optimize Folder::getById to use less queries
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'tests/lib/Files/Node/RootTest.php')
-rw-r--r--tests/lib/Files/Node/RootTest.php13
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/lib/Files/Node/RootTest.php b/tests/lib/Files/Node/RootTest.php
index 92aebcddab4..f42a42c42b1 100644
--- a/tests/lib/Files/Node/RootTest.php
+++ b/tests/lib/Files/Node/RootTest.php
@@ -16,6 +16,8 @@ class RootTest extends \Test\TestCase {
/** @var \OC\Files\Mount\Manager */
private $manager;
+ /** @var \OCP\Files\Config\IUserMountCache|\PHPUnit_Framework_MockObject_MockObject */
+ private $userMountCache;
protected function setUp() {
parent::setUp();
@@ -32,6 +34,9 @@ class RootTest extends \Test\TestCase {
$this->manager = $this->getMockBuilder('\OC\Files\Mount\Manager')
->disableOriginalConstructor()
->getMock();
+ $this->userMountCache = $this->getMockBuilder('\OCP\Files\Config\IUserMountCache')
+ ->disableOriginalConstructor()
+ ->getMock();
}
protected function getFileInfo($data) {
@@ -51,7 +56,7 @@ class RootTest extends \Test\TestCase {
$view = $this->getMockBuilder('\OC\Files\View')
->disableOriginalConstructor()
->getMock();
- $root = new \OC\Files\Node\Root($this->manager, $view, $this->user);
+ $root = new \OC\Files\Node\Root($this->manager, $view, $this->user, $this->userMountCache);
$view->expects($this->once())
->method('getFileInfo')
@@ -80,7 +85,7 @@ class RootTest extends \Test\TestCase {
$view = $this->getMockBuilder('\OC\Files\View')
->disableOriginalConstructor()
->getMock();
- $root = new \OC\Files\Node\Root($this->manager, $view, $this->user);
+ $root = new \OC\Files\Node\Root($this->manager, $view, $this->user, $this->userMountCache);
$view->expects($this->once())
->method('getFileInfo')
@@ -101,7 +106,7 @@ class RootTest extends \Test\TestCase {
$view = $this->getMockBuilder('\OC\Files\View')
->disableOriginalConstructor()
->getMock();
- $root = new \OC\Files\Node\Root($this->manager, $view, $this->user);
+ $root = new \OC\Files\Node\Root($this->manager, $view, $this->user, $this->userMountCache);
$root->get('/../foo');
}
@@ -116,7 +121,7 @@ class RootTest extends \Test\TestCase {
$view = $this->getMockBuilder('\OC\Files\View')
->disableOriginalConstructor()
->getMock();
- $root = new \OC\Files\Node\Root($this->manager, $view, $this->user);
+ $root = new \OC\Files\Node\Root($this->manager, $view, $this->user, $this->userMountCache);
$root->get('/bar/foo');
}