Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2019-09-05 13:55:24 +0300
committerChristoph Wurst <christoph@winzerhof-wurst.at>2019-12-13 15:06:12 +0300
commit3eee359d7ffd6219f6a2ab8cca18a13118552842 (patch)
tree94aa2317588ce3864a3d3715330c757f61d25713 /tests/lib/App
parent642606754b133a36d7715b45b243155cbb006f95 (diff)
Allow to force enable apps via CLI
Co-authored-by: Christoph Wurst <christoph@winzerhof-wurst.at> Signed-off-by: Joas Schilling <coding@schilljs.com> Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'tests/lib/App')
-rw-r--r--tests/lib/App/AppManagerTest.php57
1 files changed, 33 insertions, 24 deletions
diff --git a/tests/lib/App/AppManagerTest.php b/tests/lib/App/AppManagerTest.php
index 11450667fcc..0e895b5f999 100644
--- a/tests/lib/App/AppManagerTest.php
+++ b/tests/lib/App/AppManagerTest.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
/**
* Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
@@ -11,20 +11,17 @@ namespace Test\App;
use OC\App\AppManager;
use OC\AppConfig;
-use OC\Group\Group;
-use OC\User\User;
use OCP\App\AppPathNotFoundException;
use OCP\App\IAppManager;
-use OCP\IAppConfig;
use OCP\ICache;
use OCP\ICacheFactory;
use OCP\IConfig;
use OCP\IGroup;
use OCP\IGroupManager;
use OCP\ILogger;
-use OCP\IURLGenerator;
use OCP\IUser;
use OCP\IUserSession;
+use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Test\TestCase;
@@ -35,7 +32,7 @@ use Test\TestCase;
*/
class AppManagerTest extends TestCase {
/**
- * @return AppConfig|\PHPUnit_Framework_MockObject_MockObject
+ * @return AppConfig|MockObject
*/
protected function getAppConfig() {
$appConfig = array();
@@ -73,25 +70,28 @@ class AppManagerTest extends TestCase {
return $config;
}
- /** @var IUserSession|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IUserSession|MockObject */
protected $userSession;
- /** @var IGroupManager|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IConfig|MockObject */
+ private $config;
+
+ /** @var IGroupManager|MockObject */
protected $groupManager;
- /** @var AppConfig|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var AppConfig|MockObject */
protected $appConfig;
- /** @var ICache|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ICache|MockObject */
protected $cache;
- /** @var ICacheFactory|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ICacheFactory|MockObject */
protected $cacheFactory;
- /** @var EventDispatcherInterface|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var EventDispatcherInterface|MockObject */
protected $eventDispatcher;
- /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ILogger|MockObject */
protected $logger;
/** @var IAppManager */
@@ -102,6 +102,7 @@ class AppManagerTest extends TestCase {
$this->userSession = $this->createMock(IUserSession::class);
$this->groupManager = $this->createMock(IGroupManager::class);
+ $this->config = $this->createMock(IConfig::class);
$this->appConfig = $this->getAppConfig();
$this->cacheFactory = $this->createMock(ICacheFactory::class);
$this->cache = $this->createMock(ICache::class);
@@ -111,7 +112,15 @@ class AppManagerTest extends TestCase {
->method('createDistributed')
->with('settings')
->willReturn($this->cache);
- $this->manager = new AppManager($this->userSession, $this->appConfig, $this->groupManager, $this->cacheFactory, $this->eventDispatcher, $this->logger);
+ $this->manager = new AppManager(
+ $this->userSession,
+ $this->config,
+ $this->appConfig,
+ $this->groupManager,
+ $this->cacheFactory,
+ $this->eventDispatcher,
+ $this->logger
+ );
}
protected function expectClearCache() {
@@ -161,10 +170,10 @@ class AppManagerTest extends TestCase {
$groups = [$group1, $group2];
$this->expectClearCache();
- /** @var AppManager|\PHPUnit_Framework_MockObject_MockObject $manager */
+ /** @var AppManager|MockObject $manager */
$manager = $this->getMockBuilder(AppManager::class)
->setConstructorArgs([
- $this->userSession, $this->appConfig, $this->groupManager, $this->cacheFactory, $this->eventDispatcher, $this->logger
+ $this->userSession, $this->config, $this->appConfig, $this->groupManager, $this->cacheFactory, $this->eventDispatcher, $this->logger
])
->setMethods([
'getAppPath',
@@ -208,10 +217,10 @@ class AppManagerTest extends TestCase {
$groups = [$group1, $group2];
$this->expectClearCache();
- /** @var AppManager|\PHPUnit_Framework_MockObject_MockObject $manager */
+ /** @var AppManager|MockObject $manager */
$manager = $this->getMockBuilder(AppManager::class)
->setConstructorArgs([
- $this->userSession, $this->appConfig, $this->groupManager, $this->cacheFactory, $this->eventDispatcher, $this->logger
+ $this->userSession, $this->config, $this->appConfig, $this->groupManager, $this->cacheFactory, $this->eventDispatcher, $this->logger
])
->setMethods([
'getAppPath',
@@ -262,10 +271,10 @@ class AppManagerTest extends TestCase {
$groups = [$group1, $group2];
- /** @var AppManager|\PHPUnit_Framework_MockObject_MockObject $manager */
+ /** @var AppManager|MockObject $manager */
$manager = $this->getMockBuilder(AppManager::class)
->setConstructorArgs([
- $this->userSession, $this->appConfig, $this->groupManager, $this->cacheFactory, $this->eventDispatcher, $this->logger
+ $this->userSession, $this->config, $this->appConfig, $this->groupManager, $this->cacheFactory, $this->eventDispatcher, $this->logger
])
->setMethods([
'getAppPath',
@@ -426,9 +435,9 @@ class AppManagerTest extends TestCase {
}
public function testGetAppsNeedingUpgrade() {
- /** @var AppManager|\PHPUnit_Framework_MockObject_MockObject $manager */
+ /** @var AppManager|MockObject $manager */
$manager = $this->getMockBuilder(AppManager::class)
- ->setConstructorArgs([$this->userSession, $this->appConfig, $this->groupManager, $this->cacheFactory, $this->eventDispatcher, $this->logger])
+ ->setConstructorArgs([$this->userSession, $this->config, $this->appConfig, $this->groupManager, $this->cacheFactory, $this->eventDispatcher, $this->logger])
->setMethods(['getAppInfo'])
->getMock();
@@ -476,9 +485,9 @@ class AppManagerTest extends TestCase {
}
public function testGetIncompatibleApps() {
- /** @var AppManager|\PHPUnit_Framework_MockObject_MockObject $manager */
+ /** @var AppManager|MockObject $manager */
$manager = $this->getMockBuilder(AppManager::class)
- ->setConstructorArgs([$this->userSession, $this->appConfig, $this->groupManager, $this->cacheFactory, $this->eventDispatcher, $this->logger])
+ ->setConstructorArgs([$this->userSession, $this->config, $this->appConfig, $this->groupManager, $this->cacheFactory, $this->eventDispatcher, $this->logger])
->setMethods(['getAppInfo'])
->getMock();