diff options
Diffstat (limited to 'apps/settings/tests/Settings/Admin/ServerTest.php')
-rw-r--r-- | apps/settings/tests/Settings/Admin/ServerTest.php | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/apps/settings/tests/Settings/Admin/ServerTest.php b/apps/settings/tests/Settings/Admin/ServerTest.php index f9c9762cc5c..e2ca4cff3c6 100644 --- a/apps/settings/tests/Settings/Admin/ServerTest.php +++ b/apps/settings/tests/Settings/Admin/ServerTest.php @@ -25,28 +25,19 @@ use Test\TestCase; * @group DB */ class ServerTest extends TestCase { - /** @var Server */ - private $admin; - /** @var IDBConnection */ - private $connection; - /** @var IInitialState */ - private $initialStateService; - /** @var ProfileManager */ - private $profileManager; - /** @var ITimeFactory|MockObject */ - private $timeFactory; - /** @var IConfig|MockObject */ - private $config; - /** @var IAppConfig|MockObject */ - private $appConfig; - /** @var IL10N|MockObject */ - private $l10n; - /** @var IUrlGenerator|MockObject */ - private $urlGenerator; + private IDBConnection $connection; + private Server&MockObject $admin; + private IInitialState&MockObject $initialStateService; + private ProfileManager&MockObject $profileManager; + private ITimeFactory&MockObject $timeFactory; + private IConfig&MockObject $config; + private IAppConfig&MockObject $appConfig; + private IL10N&MockObject $l10n; + private IUrlGenerator&MockObject $urlGenerator; protected function setUp(): void { parent::setUp(); - $this->connection = \OC::$server->getDatabaseConnection(); + $this->connection = \OCP\Server::get(IDBConnection::class); $this->initialStateService = $this->createMock(IInitialState::class); $this->profileManager = $this->createMock(ProfileManager::class); $this->timeFactory = $this->createMock(ITimeFactory::class); @@ -78,10 +69,17 @@ class ServerTest extends TestCase { ->expects($this->any()) ->method('getAppValue') ->willReturnMap([ - ['core', 'backgroundjobs_mode', 'ajax', 'ajax'], ['core', 'lastcron', '0', '0'], ['core', 'cronErrors', ''], ]); + $this->appConfig + ->expects($this->any()) + ->method('getValueString') + ->willReturnCallback(fn ($a, $b, $default) => $default); + $this->appConfig + ->expects($this->any()) + ->method('getValueBool') + ->willReturnCallback(fn ($a, $b, $default) => $default); $this->profileManager ->expects($this->exactly(2)) ->method('isProfileEnabled') |