use OCP\ICacheFactory;
use OCP\IGroup;
use OCP\IGroupManager;
+use OCP\ILogger;
use OCP\IUser;
use OCP\IUserSession;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
/** @var EventDispatcherInterface */
private $dispatcher;
+ /** @var ILogger */
+ private $logger;
+
/** @var string[] $appId => $enabled */
private $installedAppsCache;
AppConfig $appConfig,
IGroupManager $groupManager,
ICacheFactory $memCacheFactory,
- EventDispatcherInterface $dispatcher) {
+ EventDispatcherInterface $dispatcher,
+ ILogger $logger) {
$this->userSession = $userSession;
$this->appConfig = $appConfig;
$this->groupManager = $groupManager;
$this->memCacheFactory = $memCacheFactory;
$this->dispatcher = $dispatcher;
+ $this->logger = $logger;
}
/**
if (!is_array($groupIds)) {
$jsonError = json_last_error();
- \OC::$server->getLogger()->warning('AppManger::checkAppForUser - can\'t decode group IDs: ' . print_r($enabled, true) . ' - json error code: ' . $jsonError, ['app' => 'lib']);
+ $this->logger->warning('AppManger::checkAppForUser - can\'t decode group IDs: ' . print_r($enabled, true) . ' - json error code: ' . $jsonError, ['app' => 'lib']);
return false;
}
if (!is_array($groupIds)) {
$jsonError = json_last_error();
- \OC::$server->getLogger()->warning('AppManger::checkAppForUser - can\'t decode group IDs: ' . print_r($enabled, true) . ' - json error code: ' . $jsonError, ['app' => 'lib']);
+ $this->logger->warning('AppManger::checkAppForUser - can\'t decode group IDs: ' . print_r($enabled, true) . ' - json error code: ' . $jsonError, ['app' => 'lib']);
return false;
}
use OCP\ICacheFactory;
use OCP\IGroup;
use OCP\IGroupManager;
+use OCP\ILogger;
use OCP\IUser;
use OCP\IUserSession;
use OCP\IAppConfig;
/** @var EventDispatcherInterface|\PHPUnit_Framework_MockObject_MockObject */
protected $eventDispatcher;
+ /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */
+ protected $logger;
+
/** @var IAppManager */
protected $manager;
$this->cacheFactory = $this->createMock(ICacheFactory::class);
$this->cache = $this->createMock(ICache::class);
$this->eventDispatcher = $this->createMock(EventDispatcherInterface::class);
+ $this->logger = $this->createMock(ILogger::class);
$this->cacheFactory->expects($this->any())
->method('createDistributed')
->with('settings')
->willReturn($this->cache);
- $this->manager = new AppManager($this->userSession, $this->appConfig, $this->groupManager, $this->cacheFactory, $this->eventDispatcher);
+ $this->manager = new AppManager($this->userSession, $this->appConfig, $this->groupManager, $this->cacheFactory, $this->eventDispatcher, $this->logger);
}
protected function expectClearCache() {
/** @var AppManager|\PHPUnit_Framework_MockObject_MockObject $manager */
$manager = $this->getMockBuilder(AppManager::class)
->setConstructorArgs([
- $this->userSession, $this->appConfig, $this->groupManager, $this->cacheFactory, $this->eventDispatcher
+ $this->userSession, $this->appConfig, $this->groupManager, $this->cacheFactory, $this->eventDispatcher, $this->logger
])
->setMethods([
'getAppPath',
/** @var AppManager|\PHPUnit_Framework_MockObject_MockObject $manager */
$manager = $this->getMockBuilder(AppManager::class)
->setConstructorArgs([
- $this->userSession, $this->appConfig, $this->groupManager, $this->cacheFactory, $this->eventDispatcher
+ $this->userSession, $this->appConfig, $this->groupManager, $this->cacheFactory, $this->eventDispatcher, $this->logger
])
->setMethods([
'getAppPath',
/** @var AppManager|\PHPUnit_Framework_MockObject_MockObject $manager */
$manager = $this->getMockBuilder(AppManager::class)
->setConstructorArgs([
- $this->userSession, $this->appConfig, $this->groupManager, $this->cacheFactory, $this->eventDispatcher
+ $this->userSession, $this->appConfig, $this->groupManager, $this->cacheFactory, $this->eventDispatcher, $this->logger
])
->setMethods([
'getAppPath',
public function testGetAppsNeedingUpgrade() {
/** @var AppManager|\PHPUnit_Framework_MockObject_MockObject $manager */
$manager = $this->getMockBuilder(AppManager::class)
- ->setConstructorArgs([$this->userSession, $this->appConfig, $this->groupManager, $this->cacheFactory, $this->eventDispatcher])
+ ->setConstructorArgs([$this->userSession, $this->appConfig, $this->groupManager, $this->cacheFactory, $this->eventDispatcher, $this->logger])
->setMethods(['getAppInfo'])
->getMock();
public function testGetIncompatibleApps() {
/** @var AppManager|\PHPUnit_Framework_MockObject_MockObject $manager */
$manager = $this->getMockBuilder(AppManager::class)
- ->setConstructorArgs([$this->userSession, $this->appConfig, $this->groupManager, $this->cacheFactory, $this->eventDispatcher])
+ ->setConstructorArgs([$this->userSession, $this->appConfig, $this->groupManager, $this->cacheFactory, $this->eventDispatcher, $this->logger])
->setMethods(['getAppInfo'])
->getMock();