SecuritySettingTest.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OCA\Settings\Tests;
  7. use OCA\Settings\Activity\SecuritySetting;
  8. use OCP\IL10N;
  9. use Test\TestCase;
  10. class SecuritySettingTest extends TestCase {
  11. private $l10n;
  12. /** @var SecuritySetting */
  13. private $setting;
  14. protected function setUp(): void {
  15. parent::setUp();
  16. $this->l10n = $this->createMock(IL10N::class);
  17. $this->setting = new SecuritySetting($this->l10n);
  18. }
  19. public function testCanChangeMail() {
  20. $this->assertFalse($this->setting->canChangeMail());
  21. }
  22. public function testCanChangeStream() {
  23. $this->assertFalse($this->setting->canChangeStream());
  24. }
  25. public function testGetIdentifier() {
  26. $this->assertEquals('security', $this->setting->getIdentifier());
  27. }
  28. public function testGetName() {
  29. $this->l10n->expects($this->once())
  30. ->method('t')
  31. ->with('Security')
  32. ->willReturn('Sicherheit');
  33. $this->assertEquals('Sicherheit', $this->setting->getName());
  34. }
  35. public function testGetPriority() {
  36. $this->assertEquals(30, $this->setting->getPriority());
  37. }
  38. public function testIsDefaultEnabled() {
  39. $this->assertTrue($this->setting->isDefaultEnabledMail());
  40. $this->assertTrue($this->setting->isDefaultEnabledStream());
  41. }
  42. }