aboutsummaryrefslogtreecommitdiffstats
path: root/apps/settings/tests/Activity/SecuritySettingTest.php
blob: 1b2b0e3361c4a93b5e229fe8c833448eb3280961 (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
50
51
52
53
54
<?php
/**
 * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */
namespace OCA\Settings\Tests;

use OCA\Settings\Activity\SecuritySetting;
use OCP\IL10N;
use Test\TestCase;

class SecuritySettingTest extends TestCase {
	private $l10n;

	/** @var SecuritySetting */
	private $setting;

	protected function setUp(): void {
		parent::setUp();

		$this->l10n = $this->createMock(IL10N::class);

		$this->setting = new SecuritySetting($this->l10n);
	}

	public function testCanChangeMail(): void {
		$this->assertFalse($this->setting->canChangeMail());
	}

	public function testCanChangeStream(): void {
		$this->assertFalse($this->setting->canChangeStream());
	}

	public function testGetIdentifier(): void {
		$this->assertEquals('security', $this->setting->getIdentifier());
	}

	public function testGetName(): void {
		$this->l10n->expects($this->once())
			->method('t')
			->with('Security')
			->willReturn('Sicherheit');
		$this->assertEquals('Sicherheit', $this->setting->getName());
	}

	public function testGetPriority(): void {
		$this->assertEquals(30, $this->setting->getPriority());
	}

	public function testIsDefaultEnabled(): void {
		$this->assertTrue($this->setting->isDefaultEnabledMail());
		$this->assertTrue($this->setting->isDefaultEnabledStream());
	}
}