@@ -588,107 +588,6 @@ public function testDownloadAppSuccessful(): void {
588588 $ this ->assertEquals ('0.9 ' , \OC_App::getAppVersionByPath (__DIR__ . '/../../apps/testapp/ ' ));
589589 }
590590
591- public function testIsUpdateAvailableLogsDebugForGitInstall (): void {
592- $ tmpDir = sys_get_temp_dir () . '/nc_test_git_ ' . uniqid ();
593- mkdir ($ tmpDir . '/.git ' , 0700 , true );
594-
595- $ this ->appManager
596- ->expects ($ this ->once ())
597- ->method ('getAppPath ' )
598- ->with ('myapp ' )
599- ->willReturn ($ tmpDir );
600- $ this ->logger
601- ->expects ($ this ->once ())
602- ->method ('debug ' )
603- ->with (
604- 'App {appId} is installed from git, skipping update check ' ,
605- $ this ->callback (fn ($ ctx ) => $ ctx ['appId ' ] === 'myapp ' )
606- );
607-
608- $ installer = $ this ->getInstaller ();
609- $ result = $ installer ->isUpdateAvailable ('myapp ' );
610- $ this ->assertFalse ($ result );
611-
612- rmdir ($ tmpDir . '/.git ' );
613- rmdir ($ tmpDir );
614- }
615-
616- protected function getPartialInstaller (array $ onlyMethods ): Installer &\PHPUnit \Framework \MockObject \MockObject {
617- return $ this ->getMockBuilder (Installer::class)
618- ->setConstructorArgs ([
619- $ this ->appFetcher ,
620- $ this ->clientService ,
621- $ this ->tempManager ,
622- $ this ->logger ,
623- $ this ->config ,
624- $ this ->appManager ,
625- $ this ->l10nFactory ,
626- false ,
627- ])
628- ->onlyMethods ($ onlyMethods )
629- ->getMock ();
630- }
631-
632- public function testUpdateAppstoreAppReEnablesDisabledIncompatibleApp (): void {
633- $ installer = $ this ->getPartialInstaller (['isUpdateAvailable ' , 'downloadApp ' ]);
634- $ installer ->method ('isUpdateAvailable ' )->willReturn ('1.0.0 ' );
635- $ installer ->method ('downloadApp ' );
636-
637- $ this ->appManager ->method ('isEnabledForAnyone ' )->with ('myapp ' )->willReturn (false );
638- $ this ->appManager ->method ('getAppInfo ' )->with ('myapp ' )->willReturn (['id ' => 'myapp ' , 'version ' => '0.0.1 ' ]);
639- $ this ->appManager ->method ('isAppCompatible ' )->willReturn (false );
640- $ this ->appManager ->method ('upgradeApp ' )->with ('myapp ' )->willReturn (true );
641- $ this ->appManager ->expects ($ this ->once ())->method ('enableApp ' )->with ('myapp ' );
642-
643- $ result = $ installer ->updateAppstoreApp ('myapp ' );
644- $ this ->assertTrue ($ result );
645- }
646-
647- public function testUpdateAppstoreAppDoesNotReEnableCompatibleButDisabledApp (): void {
648- $ installer = $ this ->getPartialInstaller (['isUpdateAvailable ' , 'downloadApp ' ]);
649- $ installer ->method ('isUpdateAvailable ' )->willReturn ('1.0.0 ' );
650- $ installer ->method ('downloadApp ' );
651-
652- $ this ->appManager ->method ('isEnabledForAnyone ' )->with ('myapp ' )->willReturn (false );
653- $ this ->appManager ->method ('getAppInfo ' )->with ('myapp ' )->willReturn (['id ' => 'myapp ' , 'version ' => '1.0.0 ' ]);
654- $ this ->appManager ->method ('isAppCompatible ' )->willReturn (true );
655- $ this ->appManager ->method ('upgradeApp ' )->with ('myapp ' )->willReturn (true );
656- $ this ->appManager ->expects ($ this ->never ())->method ('enableApp ' );
657-
658- $ result = $ installer ->updateAppstoreApp ('myapp ' );
659- $ this ->assertTrue ($ result );
660- }
661-
662- public function testUpdateAppstoreAppDoesNotReEnableAlreadyEnabledApp (): void {
663- $ installer = $ this ->getPartialInstaller (['isUpdateAvailable ' , 'downloadApp ' ]);
664- $ installer ->method ('isUpdateAvailable ' )->willReturn ('1.0.0 ' );
665- $ installer ->method ('downloadApp ' );
666-
667- $ this ->appManager ->method ('isEnabledForAnyone ' )->with ('myapp ' )->willReturn (true );
668- $ this ->appManager ->method ('upgradeApp ' )->with ('myapp ' )->willReturn (true );
669- $ this ->appManager ->expects ($ this ->never ())->method ('enableApp ' );
670- $ this ->appManager ->expects ($ this ->never ())->method ('getAppInfo ' );
671- $ this ->appManager ->expects ($ this ->never ())->method ('isAppCompatible ' );
672-
673- $ result = $ installer ->updateAppstoreApp ('myapp ' );
674- $ this ->assertTrue ($ result );
675- }
676-
677- public function testUpdateAppstoreAppDoesNotReEnableWhenUpgradeFails (): void {
678- $ installer = $ this ->getPartialInstaller (['isUpdateAvailable ' , 'downloadApp ' ]);
679- $ installer ->method ('isUpdateAvailable ' )->willReturn ('1.0.0 ' );
680- $ installer ->method ('downloadApp ' );
681-
682- $ this ->appManager ->method ('isEnabledForAnyone ' )->with ('myapp ' )->willReturn (false );
683- $ this ->appManager ->method ('getAppInfo ' )->with ('myapp ' )->willReturn (['id ' => 'myapp ' , 'version ' => '0.0.1 ' ]);
684- $ this ->appManager ->method ('isAppCompatible ' )->willReturn (false );
685- $ this ->appManager ->method ('upgradeApp ' )->with ('myapp ' )->willReturn (false );
686- $ this ->appManager ->expects ($ this ->never ())->method ('enableApp ' );
687-
688- $ result = $ installer ->updateAppstoreApp ('myapp ' );
689- $ this ->assertFalse ($ result );
690- }
691-
692591 public function testDownloadAppWithDowngrade (): void {
693592 // Use previous test to download the application in version 0.9
694593 $ this ->testDownloadAppSuccessful ();
0 commit comments