diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2018-12-17 15:11:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-17 15:11:28 +0100 |
commit | 6788e6e75cca95357a64202d331bf61e975df7d3 (patch) | |
tree | ef68a9d86f6c9043a47cadd7aadb3a73913b0d0f /tests | |
parent | 2d07c58f27adf5458dab52c9445d9000c9174f8a (diff) | |
parent | 036475fc91ea913eb4ed4ee14d45915d2bfeb8c6 (diff) | |
download | nextcloud-server-6788e6e75cca95357a64202d331bf61e975df7d3.tar.gz nextcloud-server-6788e6e75cca95357a64202d331bf61e975df7d3.zip |
Merge pull request #12883 from nextcloud/appdata-performance
try to grab the appdata folder directly without going trough the whole tree
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/Files/AppData/AppDataTest.php | 24 | ||||
-rw-r--r-- | tests/lib/Preview/BackgroundCleanupJobTest.php | 6 |
2 files changed, 12 insertions, 18 deletions
diff --git a/tests/lib/Files/AppData/AppDataTest.php b/tests/lib/Files/AppData/AppDataTest.php index 3247ce7ba99..1d5cea0faf1 100644 --- a/tests/lib/Files/AppData/AppDataTest.php +++ b/tests/lib/Files/AppData/AppDataTest.php @@ -55,30 +55,22 @@ class AppDataTest extends \Test\TestCase { } private function setupAppFolder() { - $dataFolder = $this->createMock(Folder::class); $appFolder = $this->createMock(Folder::class); - $this->rootFolder->expects($this->once()) - ->method('get') - ->with($this->equalTo('appdata_iid')) - ->willReturn($dataFolder); - $dataFolder->expects($this->once()) + $this->rootFolder->expects($this->any()) ->method('get') - ->with($this->equalTo('myApp')) + ->with($this->equalTo('appdata_iid/myApp')) ->willReturn($appFolder); - return [$dataFolder, $appFolder]; + return $appFolder; } public function testGetFolder() { - $folders = $this->setupAppFolder(); - $appFolder = $folders[1]; - $folder = $this->createMock(Folder::class); - $appFolder->expects($this->once()) + $this->rootFolder->expects($this->once()) ->method('get') - ->with($this->equalTo('folder')) + ->with($this->equalTo('appdata_iid/myApp/folder')) ->willReturn($folder); $result = $this->appData->getFolder('folder'); @@ -86,8 +78,7 @@ class AppDataTest extends \Test\TestCase { } public function testNewFolder() { - $folders = $this->setupAppFolder(); - $appFolder = $folders[1]; + $appFolder = $this->setupAppFolder(); $folder = $this->createMock(Folder::class); @@ -101,8 +92,7 @@ class AppDataTest extends \Test\TestCase { } public function testGetDirectoryListing() { - $folders = $this->setupAppFolder(); - $appFolder = $folders[1]; + $appFolder = $this->setupAppFolder(); $file = $this->createMock(File::class); $folder = $this->createMock(Folder::class); diff --git a/tests/lib/Preview/BackgroundCleanupJobTest.php b/tests/lib/Preview/BackgroundCleanupJobTest.php index 9d10da025dd..b33d75c6aa6 100644 --- a/tests/lib/Preview/BackgroundCleanupJobTest.php +++ b/tests/lib/Preview/BackgroundCleanupJobTest.php @@ -25,6 +25,7 @@ namespace Test\Preview; use OC\Files\AppData\Factory; use OC\Preview\BackgroundCleanupJob; use OC\PreviewManager; +use OC\SystemConfig; use OCP\Files\IRootFolder; use OCP\IDBConnection; use Test\Traits\MountProviderTrait; @@ -77,7 +78,10 @@ class BackgroundCleanupJobTest extends \Test\TestCase { $this->trashEnabled = $appManager->isEnabledForUser('files_trashbin', $this->userId); $appManager->disableApp('files_trashbin'); - $this->appDataFactory = \OC::$server->query(Factory::class); + $this->appDataFactory = new Factory( + \OC::$server->getRootFolder(), + \OC::$server->getSystemConfig() + ); $this->connection = \OC::$server->getDatabaseConnection(); $this->previewManager = \OC::$server->getPreviewManager(); $this->rootFolder = \OC::$server->getRootFolder(); |