2014-11-07 13:26:12 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
|
|
|
|
* This file is licensed under the Affero General Public License version 3 or
|
|
|
|
* later.
|
|
|
|
* See the COPYING-README file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Test\App;
|
|
|
|
|
|
|
|
use OC\Group\Group;
|
|
|
|
use OC\User\User;
|
2015-12-17 16:29:17 +00:00
|
|
|
use Test\TestCase;
|
2014-11-07 13:26:12 +00:00
|
|
|
|
2016-01-14 14:23:07 +00:00
|
|
|
/**
|
|
|
|
* Class Manager
|
|
|
|
*
|
|
|
|
* @package Test\App
|
|
|
|
*/
|
2016-05-20 13:38:20 +00:00
|
|
|
class ManagerTest extends TestCase {
|
2014-11-07 13:26:12 +00:00
|
|
|
/**
|
|
|
|
* @return \OCP\IAppConfig | \PHPUnit_Framework_MockObject_MockObject
|
|
|
|
*/
|
|
|
|
protected function getAppConfig() {
|
|
|
|
$appConfig = array();
|
|
|
|
$config = $this->getMockBuilder('\OCP\IAppConfig')
|
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
|
|
|
|
|
|
|
$config->expects($this->any())
|
|
|
|
->method('getValue')
|
|
|
|
->will($this->returnCallback(function ($app, $key, $default) use (&$appConfig) {
|
|
|
|
return (isset($appConfig[$app]) and isset($appConfig[$app][$key])) ? $appConfig[$app][$key] : $default;
|
|
|
|
}));
|
|
|
|
$config->expects($this->any())
|
|
|
|
->method('setValue')
|
|
|
|
->will($this->returnCallback(function ($app, $key, $value) use (&$appConfig) {
|
|
|
|
if (!isset($appConfig[$app])) {
|
|
|
|
$appConfig[$app] = array();
|
|
|
|
}
|
|
|
|
$appConfig[$app][$key] = $value;
|
|
|
|
}));
|
|
|
|
$config->expects($this->any())
|
|
|
|
->method('getValues')
|
|
|
|
->will($this->returnCallback(function ($app, $key) use (&$appConfig) {
|
|
|
|
if ($app) {
|
|
|
|
return $appConfig[$app];
|
|
|
|
} else {
|
|
|
|
$values = array();
|
|
|
|
foreach ($appConfig as $app => $appData) {
|
|
|
|
if (isset($appData[$key])) {
|
|
|
|
$values[$app] = $appData[$key];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $values;
|
|
|
|
}
|
|
|
|
}));
|
|
|
|
|
|
|
|
return $config;
|
|
|
|
}
|
|
|
|
|
2015-04-01 15:19:44 +00:00
|
|
|
/** @var \OCP\IUserSession */
|
|
|
|
protected $userSession;
|
|
|
|
|
|
|
|
/** @var \OCP\IGroupManager */
|
|
|
|
protected $groupManager;
|
|
|
|
|
|
|
|
/** @var \OCP\IAppConfig */
|
|
|
|
protected $appConfig;
|
|
|
|
|
|
|
|
/** @var \OCP\ICache */
|
|
|
|
protected $cache;
|
|
|
|
|
|
|
|
/** @var \OCP\ICacheFactory */
|
|
|
|
protected $cacheFactory;
|
|
|
|
|
|
|
|
/** @var \OCP\App\IAppManager */
|
|
|
|
protected $manager;
|
|
|
|
|
2016-02-09 01:51:12 +00:00
|
|
|
/** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface */
|
|
|
|
protected $eventDispatcher;
|
|
|
|
|
2015-04-01 15:19:44 +00:00
|
|
|
protected function setUp() {
|
|
|
|
parent::setUp();
|
|
|
|
|
2016-07-14 11:49:18 +00:00
|
|
|
$this->userSession = $this->getMockBuilder('\OCP\IUserSession')
|
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
|
|
|
$this->groupManager = $this->getMockBuilder('\OCP\IGroupManager')
|
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
2015-04-01 15:19:44 +00:00
|
|
|
$this->appConfig = $this->getAppConfig();
|
2016-07-14 11:49:18 +00:00
|
|
|
$this->cacheFactory = $this->getMockBuilder('\OCP\ICacheFactory')
|
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
|
|
|
$this->cache = $this->getMockBuilder('\OCP\ICache')
|
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
|
|
|
$this->eventDispatcher = $this->getMockBuilder('\Symfony\Component\EventDispatcher\EventDispatcherInterface')
|
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
2015-04-01 15:19:44 +00:00
|
|
|
$this->cacheFactory->expects($this->any())
|
|
|
|
->method('create')
|
|
|
|
->with('settings')
|
|
|
|
->willReturn($this->cache);
|
2016-02-09 01:51:12 +00:00
|
|
|
$this->manager = new \OC\App\AppManager($this->userSession, $this->appConfig, $this->groupManager, $this->cacheFactory, $this->eventDispatcher);
|
2015-04-01 15:19:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
protected function expectClearCache() {
|
|
|
|
$this->cache->expects($this->once())
|
|
|
|
->method('clear')
|
|
|
|
->with('listApps');
|
|
|
|
}
|
|
|
|
|
2014-11-07 13:26:12 +00:00
|
|
|
public function testEnableApp() {
|
2015-04-01 15:19:44 +00:00
|
|
|
$this->expectClearCache();
|
|
|
|
$this->manager->enableApp('test');
|
|
|
|
$this->assertEquals('yes', $this->appConfig->getValue('test', 'enabled', 'no'));
|
2014-11-07 13:26:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testDisableApp() {
|
2015-04-01 15:19:44 +00:00
|
|
|
$this->expectClearCache();
|
|
|
|
$this->manager->disableApp('test');
|
|
|
|
$this->assertEquals('no', $this->appConfig->getValue('test', 'enabled', 'no'));
|
2014-11-07 13:26:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testEnableAppForGroups() {
|
|
|
|
$groups = array(
|
|
|
|
new Group('group1', array(), null),
|
|
|
|
new Group('group2', array(), null)
|
|
|
|
);
|
2015-04-01 15:19:44 +00:00
|
|
|
$this->expectClearCache();
|
|
|
|
$this->manager->enableAppForGroups('test', $groups);
|
|
|
|
$this->assertEquals('["group1","group2"]', $this->appConfig->getValue('test', 'enabled', 'no'));
|
2014-11-07 13:26:12 +00:00
|
|
|
}
|
|
|
|
|
2016-01-14 14:23:07 +00:00
|
|
|
public function dataEnableAppForGroupsAllowedTypes() {
|
|
|
|
return [
|
|
|
|
[[]],
|
|
|
|
[[
|
|
|
|
'types' => [],
|
|
|
|
]],
|
|
|
|
[[
|
|
|
|
'types' => ['nickvergessen'],
|
|
|
|
]],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider dataEnableAppForGroupsAllowedTypes
|
|
|
|
*
|
|
|
|
* @param array $appInfo
|
|
|
|
*/
|
|
|
|
public function testEnableAppForGroupsAllowedTypes(array $appInfo) {
|
|
|
|
$groups = array(
|
|
|
|
new Group('group1', array(), null),
|
|
|
|
new Group('group2', array(), null)
|
|
|
|
);
|
|
|
|
$this->expectClearCache();
|
|
|
|
|
|
|
|
/** @var \OC\App\AppManager|\PHPUnit_Framework_MockObject_MockObject $manager */
|
|
|
|
$manager = $this->getMockBuilder('OC\App\AppManager')
|
|
|
|
->setConstructorArgs([
|
2016-02-09 01:51:12 +00:00
|
|
|
$this->userSession, $this->appConfig, $this->groupManager, $this->cacheFactory, $this->eventDispatcher
|
2016-01-14 14:23:07 +00:00
|
|
|
])
|
|
|
|
->setMethods([
|
|
|
|
'getAppInfo'
|
|
|
|
])
|
|
|
|
->getMock();
|
|
|
|
|
|
|
|
$manager->expects($this->once())
|
|
|
|
->method('getAppInfo')
|
|
|
|
->with('test')
|
|
|
|
->willReturn($appInfo);
|
|
|
|
|
|
|
|
$manager->enableAppForGroups('test', $groups);
|
|
|
|
$this->assertEquals('["group1","group2"]', $this->appConfig->getValue('test', 'enabled', 'no'));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function dataEnableAppForGroupsForbiddenTypes() {
|
|
|
|
return [
|
|
|
|
['filesystem'],
|
|
|
|
['prelogin'],
|
|
|
|
['authentication'],
|
|
|
|
['logging'],
|
|
|
|
['prevent_group_restriction'],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider dataEnableAppForGroupsForbiddenTypes
|
|
|
|
*
|
|
|
|
* @param string $type
|
|
|
|
*
|
|
|
|
* @expectedException \Exception
|
|
|
|
* @expectedExceptionMessage test can't be enabled for groups.
|
|
|
|
*/
|
|
|
|
public function testEnableAppForGroupsForbiddenTypes($type) {
|
|
|
|
$groups = array(
|
|
|
|
new Group('group1', array(), null),
|
|
|
|
new Group('group2', array(), null)
|
|
|
|
);
|
|
|
|
|
|
|
|
/** @var \OC\App\AppManager|\PHPUnit_Framework_MockObject_MockObject $manager */
|
|
|
|
$manager = $this->getMockBuilder('OC\App\AppManager')
|
|
|
|
->setConstructorArgs([
|
2016-02-09 01:51:12 +00:00
|
|
|
$this->userSession, $this->appConfig, $this->groupManager, $this->cacheFactory, $this->eventDispatcher
|
2016-01-14 14:23:07 +00:00
|
|
|
])
|
|
|
|
->setMethods([
|
|
|
|
'getAppInfo'
|
|
|
|
])
|
|
|
|
->getMock();
|
|
|
|
|
|
|
|
$manager->expects($this->once())
|
|
|
|
->method('getAppInfo')
|
|
|
|
->with('test')
|
|
|
|
->willReturn([
|
|
|
|
'types' => [$type],
|
|
|
|
]);
|
|
|
|
|
|
|
|
$manager->enableAppForGroups('test', $groups);
|
|
|
|
}
|
|
|
|
|
2014-11-07 13:26:12 +00:00
|
|
|
public function testIsInstalledEnabled() {
|
2015-04-01 15:19:44 +00:00
|
|
|
$this->appConfig->setValue('test', 'enabled', 'yes');
|
|
|
|
$this->assertTrue($this->manager->isInstalled('test'));
|
2014-11-07 13:26:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testIsInstalledDisabled() {
|
2015-04-01 15:19:44 +00:00
|
|
|
$this->appConfig->setValue('test', 'enabled', 'no');
|
|
|
|
$this->assertFalse($this->manager->isInstalled('test'));
|
2014-11-07 13:26:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testIsInstalledEnabledForGroups() {
|
2015-04-01 15:19:44 +00:00
|
|
|
$this->appConfig->setValue('test', 'enabled', '["foo"]');
|
|
|
|
$this->assertTrue($this->manager->isInstalled('test'));
|
2014-11-07 13:26:12 +00:00
|
|
|
}
|
|
|
|
|
2016-07-14 11:49:18 +00:00
|
|
|
private function newUser($uid) {
|
|
|
|
$config = $this->getMockBuilder('\OCP\IConfig')
|
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
|
|
|
$urlgenerator = $this->getMockBuilder('\OCP\IURLGenerator')
|
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
|
|
|
|
|
|
|
return new User($uid, null, null, $config, $urlgenerator);
|
|
|
|
}
|
|
|
|
|
2014-11-07 13:26:12 +00:00
|
|
|
public function testIsEnabledForUserEnabled() {
|
2015-04-01 15:19:44 +00:00
|
|
|
$this->appConfig->setValue('test', 'enabled', 'yes');
|
2016-07-14 11:49:18 +00:00
|
|
|
$user = $this->newUser('user1');
|
2015-04-01 15:19:44 +00:00
|
|
|
$this->assertTrue($this->manager->isEnabledForUser('test', $user));
|
2014-11-07 13:26:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testIsEnabledForUserDisabled() {
|
2015-04-01 15:19:44 +00:00
|
|
|
$this->appConfig->setValue('test', 'enabled', 'no');
|
2016-07-14 11:49:18 +00:00
|
|
|
$user = $this->newUser('user1');
|
2015-04-01 15:19:44 +00:00
|
|
|
$this->assertFalse($this->manager->isEnabledForUser('test', $user));
|
2014-11-07 13:26:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testIsEnabledForUserEnabledForGroup() {
|
2016-07-14 11:49:18 +00:00
|
|
|
$user = $this->newUser('user1');
|
2015-04-01 15:19:44 +00:00
|
|
|
$this->groupManager->expects($this->once())
|
2014-11-07 13:26:12 +00:00
|
|
|
->method('getUserGroupIds')
|
|
|
|
->with($user)
|
|
|
|
->will($this->returnValue(array('foo', 'bar')));
|
|
|
|
|
2015-04-01 15:19:44 +00:00
|
|
|
$this->appConfig->setValue('test', 'enabled', '["foo"]');
|
|
|
|
$this->assertTrue($this->manager->isEnabledForUser('test', $user));
|
2014-11-07 13:26:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testIsEnabledForUserDisabledForGroup() {
|
2016-07-14 11:49:18 +00:00
|
|
|
$user = $this->newUser('user1');
|
2015-04-01 15:19:44 +00:00
|
|
|
$this->groupManager->expects($this->once())
|
2014-11-07 13:26:12 +00:00
|
|
|
->method('getUserGroupIds')
|
|
|
|
->with($user)
|
|
|
|
->will($this->returnValue(array('bar')));
|
|
|
|
|
2015-04-01 15:19:44 +00:00
|
|
|
$this->appConfig->setValue('test', 'enabled', '["foo"]');
|
|
|
|
$this->assertFalse($this->manager->isEnabledForUser('test', $user));
|
2014-11-07 13:26:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testIsEnabledForUserLoggedOut() {
|
2015-04-01 15:19:44 +00:00
|
|
|
$this->appConfig->setValue('test', 'enabled', '["foo"]');
|
|
|
|
$this->assertFalse($this->manager->IsEnabledForUser('test'));
|
2014-11-07 13:26:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testIsEnabledForUserLoggedIn() {
|
2016-07-14 11:49:18 +00:00
|
|
|
$user = $this->newUser('user1');
|
2014-11-07 13:26:12 +00:00
|
|
|
|
2015-04-01 15:19:44 +00:00
|
|
|
$this->userSession->expects($this->once())
|
2014-11-07 13:26:12 +00:00
|
|
|
->method('getUser')
|
|
|
|
->will($this->returnValue($user));
|
2015-04-01 15:19:44 +00:00
|
|
|
$this->groupManager->expects($this->once())
|
2014-11-07 13:26:12 +00:00
|
|
|
->method('getUserGroupIds')
|
|
|
|
->with($user)
|
|
|
|
->will($this->returnValue(array('foo', 'bar')));
|
|
|
|
|
2015-04-01 15:19:44 +00:00
|
|
|
$this->appConfig->setValue('test', 'enabled', '["foo"]');
|
|
|
|
$this->assertTrue($this->manager->isEnabledForUser('test'));
|
2014-11-07 13:26:12 +00:00
|
|
|
}
|
2015-02-02 13:47:29 +00:00
|
|
|
|
|
|
|
public function testGetInstalledApps() {
|
2015-04-01 15:19:44 +00:00
|
|
|
$this->appConfig->setValue('test1', 'enabled', 'yes');
|
|
|
|
$this->appConfig->setValue('test2', 'enabled', 'no');
|
|
|
|
$this->appConfig->setValue('test3', 'enabled', '["foo"]');
|
2016-09-19 17:43:47 +00:00
|
|
|
$apps = [
|
|
|
|
'dav',
|
|
|
|
'federatedfilesharing',
|
|
|
|
'files',
|
|
|
|
'provisioning_api',
|
|
|
|
'test1',
|
|
|
|
'test3',
|
|
|
|
'twofactor_backupcodes',
|
|
|
|
'workflowengine',
|
|
|
|
];
|
2016-09-02 10:53:44 +00:00
|
|
|
$this->assertEquals($apps, $this->manager->getInstalledApps());
|
2015-02-02 13:47:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testGetAppsForUser() {
|
2016-07-14 11:49:18 +00:00
|
|
|
$user = $this->newUser('user1');
|
2015-04-01 15:19:44 +00:00
|
|
|
$this->groupManager->expects($this->any())
|
2015-02-02 13:47:29 +00:00
|
|
|
->method('getUserGroupIds')
|
|
|
|
->with($user)
|
|
|
|
->will($this->returnValue(array('foo', 'bar')));
|
|
|
|
|
2015-04-01 15:19:44 +00:00
|
|
|
$this->appConfig->setValue('test1', 'enabled', 'yes');
|
|
|
|
$this->appConfig->setValue('test2', 'enabled', 'no');
|
|
|
|
$this->appConfig->setValue('test3', 'enabled', '["foo"]');
|
|
|
|
$this->appConfig->setValue('test4', 'enabled', '["asd"]');
|
2016-09-02 10:53:44 +00:00
|
|
|
$enabled = [
|
|
|
|
'dav',
|
|
|
|
'federatedfilesharing',
|
|
|
|
'files',
|
2016-09-19 17:43:47 +00:00
|
|
|
'provisioning_api',
|
2016-09-02 10:53:44 +00:00
|
|
|
'test1',
|
|
|
|
'test3',
|
|
|
|
'twofactor_backupcodes',
|
|
|
|
'workflowengine'
|
|
|
|
];
|
|
|
|
$this->assertEquals($enabled, $this->manager->getEnabledAppsForUser($user));
|
2015-02-02 13:47:29 +00:00
|
|
|
}
|
2015-07-07 10:12:54 +00:00
|
|
|
|
|
|
|
public function testGetAppsNeedingUpgrade() {
|
|
|
|
$this->manager = $this->getMockBuilder('\OC\App\AppManager')
|
2016-02-09 01:51:12 +00:00
|
|
|
->setConstructorArgs([$this->userSession, $this->appConfig, $this->groupManager, $this->cacheFactory, $this->eventDispatcher])
|
2015-07-07 10:12:54 +00:00
|
|
|
->setMethods(['getAppInfo'])
|
|
|
|
->getMock();
|
|
|
|
|
|
|
|
$appInfos = [
|
2015-11-23 12:13:26 +00:00
|
|
|
'dav' => ['id' => 'dav'],
|
|
|
|
'files' => ['id' => 'files'],
|
2016-02-04 11:07:25 +00:00
|
|
|
'federatedfilesharing' => ['id' => 'federatedfilesharing'],
|
2016-09-19 17:43:47 +00:00
|
|
|
'provisioning_api' => ['id' => 'provisioning_api'],
|
2015-08-20 09:14:30 +00:00
|
|
|
'test1' => ['id' => 'test1', 'version' => '1.0.1', 'requiremax' => '9.0.0'],
|
2015-07-07 10:12:54 +00:00
|
|
|
'test2' => ['id' => 'test2', 'version' => '1.0.0', 'requiremin' => '8.2.0'],
|
|
|
|
'test3' => ['id' => 'test3', 'version' => '1.2.4', 'requiremin' => '9.0.0'],
|
2015-08-20 09:14:30 +00:00
|
|
|
'test4' => ['id' => 'test4', 'version' => '3.0.0', 'requiremin' => '8.1.0'],
|
2015-07-07 10:12:54 +00:00
|
|
|
'testnoversion' => ['id' => 'testnoversion', 'requiremin' => '8.2.0'],
|
2016-09-02 10:53:44 +00:00
|
|
|
'twofactor_backupcodes' => ['id' => 'twofactor_backupcodes'],
|
2016-07-26 09:16:34 +00:00
|
|
|
'workflowengine' => ['id' => 'workflowengine'],
|
2015-07-07 10:12:54 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
$this->manager->expects($this->any())
|
|
|
|
->method('getAppInfo')
|
|
|
|
->will($this->returnCallback(
|
|
|
|
function($appId) use ($appInfos) {
|
|
|
|
return $appInfos[$appId];
|
|
|
|
}
|
|
|
|
));
|
|
|
|
|
|
|
|
$this->appConfig->setValue('test1', 'enabled', 'yes');
|
|
|
|
$this->appConfig->setValue('test1', 'installed_version', '1.0.0');
|
|
|
|
$this->appConfig->setValue('test2', 'enabled', 'yes');
|
|
|
|
$this->appConfig->setValue('test2', 'installed_version', '1.0.0');
|
|
|
|
$this->appConfig->setValue('test3', 'enabled', 'yes');
|
|
|
|
$this->appConfig->setValue('test3', 'installed_version', '1.0.0');
|
2015-08-20 09:14:30 +00:00
|
|
|
$this->appConfig->setValue('test4', 'enabled', 'yes');
|
|
|
|
$this->appConfig->setValue('test4', 'installed_version', '2.4.0');
|
2015-07-07 10:12:54 +00:00
|
|
|
|
2015-08-20 09:14:30 +00:00
|
|
|
$apps = $this->manager->getAppsNeedingUpgrade('8.2.0');
|
2015-07-07 10:12:54 +00:00
|
|
|
|
|
|
|
$this->assertCount(2, $apps);
|
|
|
|
$this->assertEquals('test1', $apps[0]['id']);
|
2015-08-20 09:14:30 +00:00
|
|
|
$this->assertEquals('test4', $apps[1]['id']);
|
2015-07-07 10:12:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testGetIncompatibleApps() {
|
|
|
|
$this->manager = $this->getMockBuilder('\OC\App\AppManager')
|
2016-02-09 01:51:12 +00:00
|
|
|
->setConstructorArgs([$this->userSession, $this->appConfig, $this->groupManager, $this->cacheFactory, $this->eventDispatcher])
|
2015-07-07 10:12:54 +00:00
|
|
|
->setMethods(['getAppInfo'])
|
|
|
|
->getMock();
|
|
|
|
|
|
|
|
$appInfos = [
|
2015-11-23 12:13:26 +00:00
|
|
|
'dav' => ['id' => 'dav'],
|
|
|
|
'files' => ['id' => 'files'],
|
2016-02-04 11:07:25 +00:00
|
|
|
'federatedfilesharing' => ['id' => 'federatedfilesharing'],
|
2016-09-19 17:43:47 +00:00
|
|
|
'provisioning_api' => ['id' => 'provisioning_api'],
|
2015-07-07 10:12:54 +00:00
|
|
|
'test1' => ['id' => 'test1', 'version' => '1.0.1', 'requiremax' => '8.0.0'],
|
|
|
|
'test2' => ['id' => 'test2', 'version' => '1.0.0', 'requiremin' => '8.2.0'],
|
|
|
|
'test3' => ['id' => 'test3', 'version' => '1.2.4', 'requiremin' => '9.0.0'],
|
|
|
|
'testnoversion' => ['id' => 'testnoversion', 'requiremin' => '8.2.0'],
|
2016-09-02 10:53:44 +00:00
|
|
|
'twofactor_backupcodes' => ['id' => 'twofactor_backupcodes'],
|
2016-07-26 09:16:34 +00:00
|
|
|
'workflowengine' => ['id' => 'workflowengine'],
|
2015-07-07 10:12:54 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
$this->manager->expects($this->any())
|
|
|
|
->method('getAppInfo')
|
|
|
|
->will($this->returnCallback(
|
|
|
|
function($appId) use ($appInfos) {
|
|
|
|
return $appInfos[$appId];
|
|
|
|
}
|
|
|
|
));
|
|
|
|
|
|
|
|
$this->appConfig->setValue('test1', 'enabled', 'yes');
|
|
|
|
$this->appConfig->setValue('test2', 'enabled', 'yes');
|
|
|
|
$this->appConfig->setValue('test3', 'enabled', 'yes');
|
|
|
|
|
|
|
|
$apps = $this->manager->getIncompatibleApps('8.2.0');
|
|
|
|
|
|
|
|
$this->assertCount(2, $apps);
|
|
|
|
$this->assertEquals('test1', $apps[0]['id']);
|
|
|
|
$this->assertEquals('test3', $apps[1]['id']);
|
|
|
|
}
|
2014-11-07 13:26:12 +00:00
|
|
|
}
|