connection = \OCP\Server::get(IDBConnection::class);
$this->initialStateService = $this->createMock(IInitialState::class);
$this->profileManager = $this->createMock(ProfileManager::class);
$this->timeFactory = $this->createMock(ITimeFactory::class);
$this->config = $this->createMock(IConfig::class);
$this->appConfig = $this->createMock(IAppConfig::class);
$this->l10n = $this->createMock(IL10N::class);
$this->urlGenerator = $this->createMock(IUrlGenerator::class);
$this->admin = $this->getMockBuilder(Server::class)
->onlyMethods(['cronMaxAge'])
->setConstructorArgs([
$this->connection,
$this->initialStateService,
$this->profileManager,
$this->timeFactory,
$this->urlGenerator,
$this->config,
$this->appConfig,
$this->l10n,
])
->getMock();
}
public function testGetForm(): void {
$this->admin->expects($this->once())
->method('cronMaxAge')
->willReturn(1337);
$this->config
->expects($this->any())
->method('getAppValue')
->willReturnMap([
['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')
->willReturn(true);
$expected = new TemplateResponse(
'settings',
'settings/admin/server',
[
'profileEnabledGlobally' => true,
],
''
);
$this->assertEquals($expected, $this->admin->getForm());
}
public function testGetSection(): void {
$this->assertSame('server', $this->admin->getSection());
}
public function testGetPriority(): void {
$this->assertSame(0, $this->admin->getPriority());
}
}
d-integration-tests-for-moving-a-file-from-and-to-a-shared-folder'>add-integration-tests-for-moving-a-file-from-and-to-a-shared-folder
Nextcloud server, a safe home for all your data: https://github.com/nextcloud/server | www-data |
blob: 88b60a564b3de5e3f7532a195bbce92e2c2cafd5 (
plain)