]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix tests
authorLukas Reschke <lukas@statuscode.ch>
Thu, 27 Oct 2016 18:13:15 +0000 (20:13 +0200)
committerLukas Reschke <lukas@statuscode.ch>
Mon, 31 Oct 2016 16:17:45 +0000 (17:17 +0100)
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
apps/files_sharing/tests/UpdaterTest.php
core/Command/App/Enable.php
tests/Settings/Controller/AppSettingsControllerTest.php
tests/enable_all.php
tests/lib/InstallerTest.php
tests/lib/StreamWrappersTest.php

index da292826f0aba5cb0209187e8d81df547db4be03..bb320336d4898df726ad55151a860c0af9abd966 100644 (file)
@@ -71,7 +71,8 @@ class UpdaterTest extends TestCase {
         */
        function testDeleteParentFolder() {
                $status = \OC_App::isEnabled('files_trashbin');
-               \OC_App::enable('files_trashbin');
+               (new \OC_App())->enable('files_trashbin');
+
 
                \OCA\Files_Trashbin\Trashbin::registerHooks();
 
index 19f24d82e43b5b96137c9eef4d1d3db4fd40cf06..4aa38cd6f8feab5d5dc45de3c00d5e220faffde6 100644 (file)
@@ -75,11 +75,12 @@ class Enable extends Command implements CompletionAwareInterface {
                }
 
                $groups = $input->getOption('groups');
+               $appClass = new \OC_App();
                if (empty($groups)) {
-                       \OC_App::enable($appId);
+                       $appClass->enable($appId);
                        $output->writeln($appId . ' enabled');
                } else {
-                       \OC_App::enable($appId, $groups);
+                       $appClass->enable($appId, $groups);
                        $output->writeln($appId . ' enabled for groups: ' . implode(', ', $groups));
                }
                return 0;
index fc9d04fcfe79a0e0989c3309da4a0f29914c0292..72fcf1bd7fcb8b36d848fa40bb775c4912be58f0 100644 (file)
@@ -29,6 +29,7 @@ use OCP\AppFramework\Http\ContentSecurityPolicy;
 use OCP\AppFramework\Http\JSONResponse;
 use OCP\AppFramework\Http\TemplateResponse;
 use OCP\ICacheFactory;
+use OCP\L10N\IFactory;
 use Test\TestCase;
 use OCP\IRequest;
 use OCP\IL10N;
@@ -61,6 +62,8 @@ class AppSettingsControllerTest extends TestCase {
        private $categoryFetcher;
        /** @var AppFetcher|\PHPUnit_Framework_MockObject_MockObject */
        private $appFetcher;
+       /** @var IFactory|\PHPUnit_Framework_MockObject_MockObject */
+       private $l10nFactory;
 
        public function setUp() {
                parent::setUp();
@@ -82,6 +85,7 @@ class AppSettingsControllerTest extends TestCase {
                $this->appManager = $this->createMock(IAppManager::class);
                $this->categoryFetcher = $this->createMock(CategoryFetcher::class);
                $this->appFetcher = $this->createMock(AppFetcher::class);
+               $this->l10nFactory = $this->createMock(IFactory::class);
 
                $this->appSettingsController = new AppSettingsController(
                        'settings',
@@ -92,7 +96,8 @@ class AppSettingsControllerTest extends TestCase {
                        $this->navigationManager,
                        $this->appManager,
                        $this->categoryFetcher,
-                       $this->appFetcher
+                       $this->appFetcher,
+                       $this->l10nFactory
                );
        }
 
index afea5c89665a793fc57fa53f76dd0caa75e73af2..655597be7c8d0a7caeb5693936598439a5582e15 100644 (file)
@@ -10,7 +10,7 @@ require_once __DIR__.'/../lib/base.php';
 
 function enableApp($app) {
        try {
-               OC_App::enable($app);
+               (new \OC_App())->enable($app);
        } catch (Exception $e) {
                echo $e;
        }
index e1c17b841a27f77ee970a5b0d1cc0c3dc8589cee..11c0e2675b13f10bd7aceb39f8b7ba36d14dd8ea 100644 (file)
@@ -49,7 +49,8 @@ class InstallerTest extends TestCase {
                        ]
                );
 
-               Installer::installApp($data);
+               $installer = new Installer();
+               $installer->installApp($data);
                $isInstalled = Installer::isInstalled(self::$appid);
 
                $this->assertTrue($isInstalled);
@@ -88,7 +89,8 @@ class InstallerTest extends TestCase {
                        ]
                );
 
-               Installer::installApp($oldData);
+               $installer = new Installer();
+               $installer->installApp($oldData);
                $oldVersionNumber = \OC_App::getAppVersion(self::$appid);
 
                Installer::updateApp($newData);
index c0ecb5e738bda4e0659342adfea807d5044752ee..eb35fd54454fb885a76307298d9502959ad011dd 100644 (file)
@@ -38,7 +38,7 @@ class StreamWrappersTest extends \Test\TestCase {
 
        public static function tearDownAfterClass() {
                if (self::$trashBinStatus) {
-                       \OC_App::enable('files_trashbin');
+                       (new \OC_App())->enable('files_trashbin');
                }
        }