aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/private/App/AppManager.php1
-rw-r--r--tests/lib/App/AppManagerTest.php11
-rw-r--r--tests/lib/AppTest.php8
3 files changed, 15 insertions, 5 deletions
diff --git a/lib/private/App/AppManager.php b/lib/private/App/AppManager.php
index d4dc8c74960..4223d09e3dc 100644
--- a/lib/private/App/AppManager.php
+++ b/lib/private/App/AppManager.php
@@ -135,6 +135,7 @@ class AppManager implements IAppManager {
*/
private function getEnabledAppsValues(): array {
if (!$this->enabledAppsCache) {
+ /** @var array<string,string> */
$values = $this->getAppConfig()->searchValues('enabled', false, IAppConfig::VALUE_STRING);
$alwaysEnabledApps = $this->getAlwaysEnabledApps();
diff --git a/tests/lib/App/AppManagerTest.php b/tests/lib/App/AppManagerTest.php
index c8f7f2cb172..48d722761bc 100644
--- a/tests/lib/App/AppManagerTest.php
+++ b/tests/lib/App/AppManagerTest.php
@@ -71,6 +71,17 @@ class AppManagerTest extends TestCase {
return $values;
}
});
+ $config->expects($this->any())
+ ->method('searchValues')
+ ->willReturnCallback(function ($key, $lazy, $type) use (&$appConfig) {
+ $values = [];
+ foreach ($appConfig as $appid => $appData) {
+ if (isset($appData[$key])) {
+ $values[$appid] = $appData[$key];
+ }
+ }
+ return $values;
+ });
return $config;
}
diff --git a/tests/lib/AppTest.php b/tests/lib/AppTest.php
index b817d968910..cd33be9378d 100644
--- a/tests/lib/AppTest.php
+++ b/tests/lib/AppTest.php
@@ -485,7 +485,7 @@ class AppTest extends \Test\TestCase {
\OC_User::setUserId($user);
$this->setupAppConfigMock()->expects($this->once())
- ->method('getValues')
+ ->method('searchValues')
->willReturn(
[
'app3' => 'yes',
@@ -495,7 +495,6 @@ class AppTest extends \Test\TestCase {
'appforgroup2' => '["group2"]',
'appforgroup12' => '["group2","group1"]',
]
-
);
$apps = \OC_App::getEnabledApps(false, $forceAll);
@@ -524,13 +523,12 @@ class AppTest extends \Test\TestCase {
\OC_User::setUserId(self::TEST_USER1);
$this->setupAppConfigMock()->expects($this->once())
- ->method('getValues')
+ ->method('searchValues')
->willReturn(
[
'app3' => 'yes',
'app2' => 'no',
]
-
);
$apps = \OC_App::getEnabledApps();
@@ -550,7 +548,7 @@ class AppTest extends \Test\TestCase {
private function setupAppConfigMock() {
/** @var AppConfig|MockObject */
$appConfig = $this->getMockBuilder(AppConfig::class)
- ->onlyMethods(['getValues'])
+ ->onlyMethods(['searchValues'])
->setConstructorArgs([\OCP\Server::get(IDBConnection::class)])
->disableOriginalConstructor()
->getMock();