0
0
Fork 0
mirror of https://github.com/nextcloud/server.git synced 2025-02-12 12:09:14 +00:00
nextcloud_server/apps/federation/tests/Settings/AdminTest.php
Christoph Wurst 49dd79eabb
refactor: Add void return type to PHPUnit test methods
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2024-09-15 22:32:31 +02:00

49 lines
1.3 KiB
PHP

<?php
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\Federation\Tests\Settings;
use OCA\Federation\Settings\Admin;
use OCA\Federation\TrustedServers;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IL10N;
use Test\TestCase;
class AdminTest extends TestCase {
/** @var Admin */
private $admin;
/** @var TrustedServers */
private $trustedServers;
protected function setUp(): void {
parent::setUp();
$this->trustedServers = $this->getMockBuilder('\OCA\Federation\TrustedServers')->disableOriginalConstructor()->getMock();
$this->admin = new Admin(
$this->trustedServers,
$this->createMock(IL10N::class)
);
}
public function testGetForm(): void {
$this->trustedServers
->expects($this->once())
->method('getServers')
->willReturn(['myserver', 'secondserver']);
$params = [
'trustedServers' => ['myserver', 'secondserver'],
];
$expected = new TemplateResponse('federation', 'settings-admin', $params, '');
$this->assertEquals($expected, $this->admin->getForm());
}
public function testGetSection(): void {
$this->assertSame('sharing', $this->admin->getSection());
}
public function testGetPriority(): void {
$this->assertSame(30, $this->admin->getPriority());
}
}