chore(tests): Do not mock DependencyAnalyzer in AppManagerTest

Not ideal to have coupled tests like that but it’s the easiest path
 forward to make sure the tests still covers the same usecase and avoid
 code duplication.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
pull/53895/head
Côme Chilliet 2025-08-18 12:34:43 +07:00
parent 12edd2b23a
commit f5111c0961
No known key found for this signature in database
GPG Key ID: A3E2F658B28C760A
1 changed files with 5 additions and 3 deletions

@ -12,6 +12,7 @@ namespace Test\App;
use OC\App\AppManager;
use OC\App\DependencyAnalyzer;
use OC\App\Platform;
use OC\AppConfig;
use OC\Config\ConfigManager;
use OCP\App\AppPathNotFoundException;
@ -95,7 +96,8 @@ class AppManagerTest extends TestCase {
protected IURLGenerator&MockObject $urlGenerator;
protected ServerVersion&MockObject $serverVersion;
protected ConfigManager&MockObject $configManager;
protected DependencyAnalyzer&MockObject $dependencyAnalyzer;
protected DependencyAnalyzer $dependencyAnalyzer;
protected AppManager $manager;
@ -113,7 +115,7 @@ class AppManagerTest extends TestCase {
$this->urlGenerator = $this->createMock(IURLGenerator::class);
$this->serverVersion = $this->createMock(ServerVersion::class);
$this->configManager = $this->createMock(ConfigManager::class);
$this->dependencyAnalyzer = $this->createMock(DependencyAnalyzer::class);
$this->dependencyAnalyzer = new DependencyAnalyzer($this->createMock(Platform::class));
$this->overwriteService(AppConfig::class, $this->appConfig);
$this->overwriteService(IURLGenerator::class, $this->urlGenerator);
@ -594,7 +596,7 @@ class AppManagerTest extends TestCase {
}
public function testGetAppsNeedingUpgrade(): void {
/** @var AppManager|MockObject $manager */
/** @var AppManager&MockObject $manager */
$manager = $this->getMockBuilder(AppManager::class)
->setConstructorArgs([
$this->userSession,