summaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/Files/AppData/AppDataTest.php24
-rw-r--r--tests/lib/Preview/BackgroundCleanupJobTest.php6
-rw-r--r--tests/lib/Repair/SetVcardDatabaseUIDTest.php11
-rw-r--r--tests/lib/Share20/ManagerTest.php6
-rw-r--r--tests/lib/Template/IconsCacherTest.php2
5 files changed, 23 insertions, 26 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();
diff --git a/tests/lib/Repair/SetVcardDatabaseUIDTest.php b/tests/lib/Repair/SetVcardDatabaseUIDTest.php
index 97da3c6a901..2939528a21a 100644
--- a/tests/lib/Repair/SetVcardDatabaseUIDTest.php
+++ b/tests/lib/Repair/SetVcardDatabaseUIDTest.php
@@ -24,6 +24,8 @@
namespace Test\Repair;
use OCP\IConfig;
+use OCP\ILogger;
+use OCP\Migration\IOutput;
use OC\Repair\NC15\SetVcardDatabaseUID;
use Test\TestCase;
@@ -38,11 +40,15 @@ class SetVcardDatabaseUIDTest extends TestCase {
/** @var IConfig */
private $config;
+ /** @var Ilogger */
+ private $logger;
+
protected function setUp() {
parent::setUp();
$this->config = $this->createMock(IConfig::class);
- $this->repair = new SetVcardDatabaseUID(\OC::$server->getDatabaseConnection(), $this->config);
+ $this->logger = $this->createMock(Ilogger::class);
+ $this->repair = new SetVcardDatabaseUID(\OC::$server->getDatabaseConnection(), $this->config, $this->logger);
}
protected function tearDown() {
@@ -86,7 +92,8 @@ class SetVcardDatabaseUIDTest extends TestCase {
* @param string|boolean $expected
*/
public function testExtractUIDFromVcard($from, $expected) {
- $uid = $this->invokePrivate($this->repair, 'getUid', ['carddata' => $from]);
+ $output = $this->createMock(IOutput::class);
+ $uid = $this->invokePrivate($this->repair, 'getUid', ['carddata' => $from, 'output' => $output]);
$this->assertEquals($expected, $uid);
}
diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php
index 1125cae9565..80747e1a157 100644
--- a/tests/lib/Share20/ManagerTest.php
+++ b/tests/lib/Share20/ManagerTest.php
@@ -1707,8 +1707,6 @@ class ManagerTest extends \Test\TestCase {
->with('password')
->willReturn('hashed');
- $this->secureRandom->method('getMediumStrengthGenerator')
- ->will($this->returnSelf());
$this->secureRandom->method('generate')
->willReturn('token');
@@ -1818,8 +1816,6 @@ class ManagerTest extends \Test\TestCase {
$manager->expects($this->never())
->method('setLinkParent');
- $this->secureRandom->method('getMediumStrengthGenerator')
- ->will($this->returnSelf());
$this->secureRandom->method('generate')
->willReturn('token');
@@ -1947,7 +1943,7 @@ class ManagerTest extends \Test\TestCase {
$manager->createShare($share);
}
- public function testCreateShareOfIncommingFederatedShare() {
+ public function testCreateShareOfIncomingFederatedShare() {
$manager = $this->createManagerMock()
->setMethods(['canShare', 'generalCreateChecks', 'userCreateChecks', 'pathCreateChecks'])
->getMock();
diff --git a/tests/lib/Template/IconsCacherTest.php b/tests/lib/Template/IconsCacherTest.php
index cc6224f3228..37624356443 100644
--- a/tests/lib/Template/IconsCacherTest.php
+++ b/tests/lib/Template/IconsCacherTest.php
@@ -144,7 +144,7 @@ class IconsCacherTest extends \Test\TestCase {
";
$iconsFile = $this->createMock(ISimpleFile::class);
- $this->folder->expects($this->exactly(6))
+ $this->folder->expects($this->exactly(4))
->method('getFile')
->willReturn($iconsFile);