diff options
author | Daniel Rudolf <github.com@daniel-rudolf.de> | 2021-07-01 16:00:29 +0200 |
---|---|---|
committer | Daniel Rudolf <github.com@daniel-rudolf.de> | 2021-07-01 16:00:29 +0200 |
commit | e16bf707aab3c155f871f6ee6d60079932ecc014 (patch) | |
tree | ce5f8778c416ce3102cd3371bcb841af905d762d /tests | |
parent | a43de10d1e772be7b891c1717468d2c7d6e9b836 (diff) | |
download | nextcloud-server-e16bf707aab3c155f871f6ee6d60079932ecc014.tar.gz nextcloud-server-e16bf707aab3c155f871f6ee6d60079932ecc014.zip |
Fix UtilTest::testDefaultApps()
Oh wow... This definitly was no best practice... :unamused:
Signed-off-by: Daniel Rudolf <github.com@daniel-rudolf.de>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/UtilTest.php | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/tests/lib/UtilTest.php b/tests/lib/UtilTest.php index 55b86f06955..9a82f3c5ac6 100644 --- a/tests/lib/UtilTest.php +++ b/tests/lib/UtilTest.php @@ -187,15 +187,16 @@ class UtilTest extends \Test\TestCase { ->willReturnCallback(function ($appId) use ($enabledApps) { return in_array($appId, $enabledApps); }); - Dummy_OC_Util::$appManager = $appManager; + $this->overwriteService(IAppManager::class, $appManager); // need to set a user id to make sure enabled apps are read from cache \OC_User::setUserId($this->getUniqueID()); \OC::$server->getConfig()->setSystemValue('defaultapp', $defaultAppConfig); - $this->assertEquals('http://localhost/' . $expectedPath, Dummy_OC_Util::getDefaultPageUrl()); + $this->assertEquals('http://localhost/' . $expectedPath, OC_Util::getDefaultPageUrl()); // restore old state \OC::$WEBROOT = $oldWebRoot; + $this->restoreService(IAppManager::class); \OC::$server->getConfig()->setSystemValue('defaultapp', $oldDefaultApps); \OC_User::setUserId(null); } @@ -360,17 +361,3 @@ class UtilTest extends \Test\TestCase { ], \OC_Util::$styles); } } - -/** - * Dummy OC Util class to make it possible to override the app manager - */ -class Dummy_OC_Util extends OC_Util { - /** - * @var \OCP\App\IAppManager - */ - public static $appManager; - - protected static function getAppManager() { - return self::$appManager; - } -} |