diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/karma.config.js | 1 | ||||
-rw-r--r-- | tests/lib/NavigationManagerTest.php | 4 | ||||
-rw-r--r-- | tests/lib/TestCase.php | 15 |
3 files changed, 13 insertions, 7 deletions
diff --git a/tests/karma.config.js b/tests/karma.config.js index 18c18f0b7b9..95392425f4d 100644 --- a/tests/karma.config.js +++ b/tests/karma.config.js @@ -52,7 +52,6 @@ module.exports = function(config) { srcFiles: [ // only test these files, others are not ready and mess // up with the global namespace/classes/state - 'apps/files_sharing/js/app.js', 'apps/files_sharing/js/dist/additionalScripts.js', 'apps/files_sharing/js/dist/files_sharing_tab.js', 'apps/files_sharing/js/dist/files_sharing.js', diff --git a/tests/lib/NavigationManagerTest.php b/tests/lib/NavigationManagerTest.php index 4f1cabc3cba..a33a06635c9 100644 --- a/tests/lib/NavigationManagerTest.php +++ b/tests/lib/NavigationManagerTest.php @@ -244,7 +244,7 @@ class NavigationManagerTest extends TestCase { $apps = [ 'core_apps' => [ 'id' => 'core_apps', - 'order' => 3, + 'order' => 4, 'href' => '/apps/test/', 'icon' => '/apps/settings/img/apps.svg', 'name' => 'Apps', @@ -256,7 +256,7 @@ class NavigationManagerTest extends TestCase { $defaults = [ 'settings' => [ 'id' => 'settings', - 'order' => 1, + 'order' => 2, 'href' => '/apps/test/', 'icon' => '/apps/settings/img/admin.svg', 'name' => 'Settings', diff --git a/tests/lib/TestCase.php b/tests/lib/TestCase.php index 88c5b468543..38cfc4a1c8f 100644 --- a/tests/lib/TestCase.php +++ b/tests/lib/TestCase.php @@ -51,13 +51,16 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase { * @param mixed $newService * @return bool */ - public function overwriteService($name, $newService) { + public function overwriteService(string $name, $newService): bool { if (isset($this->services[$name])) { return false; } $this->services[$name] = \OC::$server->query($name); - \OC::$server->registerService($name, function () use ($newService) { + $container = \OC::$server->getAppContainerForService($name); + $container = $container ?? \OC::$server; + + $container->registerService($name, function () use ($newService) { return $newService; }); @@ -68,10 +71,14 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase { * @param string $name * @return bool */ - public function restoreService($name) { + public function restoreService(string $name): bool { if (isset($this->services[$name])) { $oldService = $this->services[$name]; - \OC::$server->registerService($name, function () use ($oldService) { + + $container = \OC::$server->getAppContainerForService($name); + $container = $container ?? \OC::$server; + + $container->registerService($name, function () use ($oldService) { return $oldService; }); |