Skip to content

Commit 1215976

Browse files
committed
fixup! fix: Deduplicate code by using DependencyAnalyzer in the AppManager
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
1 parent 7261f1c commit 1215976

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

tests/lib/App/AppManagerTest.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
namespace Test\App;
1212

1313
use OC\App\AppManager;
14+
use OC\App\DependencyAnalyzer;
1415
use OC\AppConfig;
1516
use OC\Config\ConfigManager;
1617
use OCP\App\AppPathNotFoundException;
1718
use OCP\App\Events\AppDisableEvent;
1819
use OCP\App\Events\AppEnableEvent;
19-
use OCP\App\IAppManager;
2020
use OCP\EventDispatcher\IEventDispatcher;
2121
use OCP\ICache;
2222
use OCP\ICacheFactory;
@@ -95,9 +95,9 @@ protected function getAppConfig(): AppConfig&MockObject {
9595
protected IURLGenerator&MockObject $urlGenerator;
9696
protected ServerVersion&MockObject $serverVersion;
9797
protected ConfigManager&MockObject $configManager;
98+
protected DependencyAnalyzer&MockObject $dependencyAnalyzer;
9899

99-
/** @var IAppManager */
100-
protected $manager;
100+
protected AppManager $manager;
101101

102102
protected function setUp(): void {
103103
parent::setUp();
@@ -113,6 +113,7 @@ protected function setUp(): void {
113113
$this->urlGenerator = $this->createMock(IURLGenerator::class);
114114
$this->serverVersion = $this->createMock(ServerVersion::class);
115115
$this->configManager = $this->createMock(ConfigManager::class);
116+
$this->dependencyAnalyzer = $this->createMock(DependencyAnalyzer::class);
116117

117118
$this->overwriteService(AppConfig::class, $this->appConfig);
118119
$this->overwriteService(IURLGenerator::class, $this->urlGenerator);
@@ -279,6 +280,7 @@ public function testEnableAppForGroups(): void {
279280
$this->logger,
280281
$this->serverVersion,
281282
$this->configManager,
283+
$this->dependencyAnalyzer,
282284
])
283285
->onlyMethods([
284286
'getAppPath',
@@ -333,6 +335,7 @@ public function testEnableAppForGroupsAllowedTypes(array $appInfo): void {
333335
$this->logger,
334336
$this->serverVersion,
335337
$this->configManager,
338+
$this->dependencyAnalyzer,
336339
])
337340
->onlyMethods([
338341
'getAppPath',
@@ -396,6 +399,7 @@ public function testEnableAppForGroupsForbiddenTypes($type): void {
396399
$this->logger,
397400
$this->serverVersion,
398401
$this->configManager,
402+
$this->dependencyAnalyzer,
399403
])
400404
->onlyMethods([
401405
'getAppPath',
@@ -602,6 +606,7 @@ public function testGetAppsNeedingUpgrade(): void {
602606
$this->logger,
603607
$this->serverVersion,
604608
$this->configManager,
609+
$this->dependencyAnalyzer,
605610
])
606611
->onlyMethods(['getAppInfo'])
607612
->getMock();
@@ -663,6 +668,7 @@ public function testGetIncompatibleApps(): void {
663668
$this->logger,
664669
$this->serverVersion,
665670
$this->configManager,
671+
$this->dependencyAnalyzer,
666672
])
667673
->onlyMethods(['getAppInfo'])
668674
->getMock();
@@ -803,6 +809,7 @@ public function testGetAppVersion() {
803809
$this->logger,
804810
$this->serverVersion,
805811
$this->configManager,
812+
$this->dependencyAnalyzer,
806813
])
807814
->onlyMethods([
808815
'getAppInfo',
@@ -835,6 +842,7 @@ public function testGetAppVersionCore() {
835842
$this->logger,
836843
$this->serverVersion,
837844
$this->configManager,
845+
$this->dependencyAnalyzer,
838846
])
839847
->onlyMethods([
840848
'getAppInfo',
@@ -866,6 +874,7 @@ public function testGetAppVersionUnknown() {
866874
$this->logger,
867875
$this->serverVersion,
868876
$this->configManager,
877+
$this->dependencyAnalyzer,
869878
])
870879
->onlyMethods([
871880
'getAppInfo',

0 commit comments

Comments
 (0)