aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_external/tests/Settings/SectionTest.php
blob: 9154106ff8a84b742815174c6118d23bf596c665 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
/**
 * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */
namespace OCA\Files_External\Tests\Settings;

use OCA\Files_External\Settings\Section;
use OCP\IL10N;
use OCP\IURLGenerator;
use Test\TestCase;

class SectionTest extends TestCase {
	/** @var IL10N */
	private $l;
	/** @var IURLGenerator */
	private $urlGenerator;
	/** @var Section */
	private $section;

	protected function setUp(): void {
		parent::setUp();
		$this->urlGenerator = $this->getMockBuilder(IURLGenerator::class)->disableOriginalConstructor()->getMock();
		$this->l = $this->getMockBuilder(IL10N::class)->disableOriginalConstructor()->getMock();

		$this->section = new Section(
			$this->urlGenerator,
			$this->l
		);
	}

	public function testGetID(): void {
		$this->assertSame('externalstorages', $this->section->getID());
	}

	public function testGetName(): void {
		$this->l
			->expects($this->once())
			->method('t')
			->with('External storage')
			->willReturn('External storage');

		$this->assertSame('External storage', $this->section->getName());
	}

	public function testGetPriority(): void {
		$this->assertSame(10, $this->section->getPriority());
	}
}