nextcloud/apps/federation/tests/Settings/AdminTest.php

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

51 lines
1.3 KiB
PHP
Raw Normal View History

2016-08-15 10:24:56 -04:00
<?php
declare(strict_types=1);
2016-08-15 10:24:56 -04:00
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
2016-08-15 10:24:56 -04:00
*/
namespace OCA\Federation\Tests\Settings;
use OCA\Federation\Settings\Admin;
use OCA\Federation\TrustedServers;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IL10N;
use PHPUnit\Framework\MockObject\MockObject;
2016-08-15 10:24:56 -04:00
use Test\TestCase;
class AdminTest extends TestCase {
private TrustedServers&MockObject $trustedServers;
private Admin $admin;
2016-08-15 10:24:56 -04:00
protected function setUp(): void {
2016-08-15 10:24:56 -04:00
parent::setUp();
$this->trustedServers = $this->createMock(TrustedServers::class);
2016-08-15 10:24:56 -04:00
$this->admin = new Admin(
$this->trustedServers,
$this->createMock(IL10N::class)
2016-08-15 10:24:56 -04:00
);
}
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());
}
}