You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nextcloud-server/apps/federation/tests/Settings/AdminTest.php

50 lines
1.3 KiB

10 years ago
<?php
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
10 years ago
*/
namespace OCA\Federation\Tests\Settings;
use OCA\Federation\Settings\Admin;
use OCA\Federation\TrustedServers;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IL10N;
10 years ago
use Test\TestCase;
class AdminTest extends TestCase {
/** @var Admin */
private $admin;
/** @var TrustedServers */
private $trustedServers;
protected function setUp(): void {
10 years ago
parent::setUp();
$this->trustedServers = $this->getMockBuilder('\OCA\Federation\TrustedServers')->disableOriginalConstructor()->getMock();
10 years ago
$this->admin = new Admin(
$this->trustedServers,
$this->createMock(IL10N::class)
10 years ago
);
}
public function testGetForm(): void {
10 years ago
$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 {
10 years ago
$this->assertSame('sharing', $this->admin->getSection());
}
public function testGetPriority(): void {
10 years ago
$this->assertSame(30, $this->admin->getPriority());
}
}