config = $this->getMockBuilder(IConfig::class)->getMock(); $this->l10n = $this->getMockBuilder(IL10N::class)->getMock(); $this->maintenancePlugin = new MaintenancePlugin($this->config, $this->l10n); } public function testMaintenanceMode(): void { $this->expectException(\Sabre\DAV\Exception\ServiceUnavailable::class); $this->expectExceptionMessage('System is in maintenance mode.'); $this->config ->expects($this->exactly(1)) ->method('getSystemValueBool') ->with('maintenance') ->willReturn(true); $this->l10n ->expects($this->any()) ->method('t') ->willReturnArgument(0); $this->maintenancePlugin->checkMaintenanceMode(); } }