1
0

SecuritySettingTest.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016 Christoph Wurst <christoph@winzerhof-wurst.at>
  4. *
  5. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  6. * @author Roeland Jago Douma <roeland@famdouma.nl>
  7. *
  8. * @license GNU AGPL version 3 or any later version
  9. *
  10. * This program is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License as
  12. * published by the Free Software Foundation, either version 3 of the
  13. * License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Affero General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public License
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. *
  23. */
  24. namespace OCA\Settings\Tests;
  25. use OCA\Settings\Activity\SecuritySetting;
  26. use OCP\IL10N;
  27. use Test\TestCase;
  28. class SecuritySettingTest extends TestCase {
  29. private $l10n;
  30. /** @var SecuritySetting */
  31. private $setting;
  32. protected function setUp(): void {
  33. parent::setUp();
  34. $this->l10n = $this->createMock(IL10N::class);
  35. $this->setting = new SecuritySetting($this->l10n);
  36. }
  37. public function testCanChangeMail() {
  38. $this->assertFalse($this->setting->canChangeMail());
  39. }
  40. public function testCanChangeStream() {
  41. $this->assertFalse($this->setting->canChangeStream());
  42. }
  43. public function testGetIdentifier() {
  44. $this->assertEquals('security', $this->setting->getIdentifier());
  45. }
  46. public function testGetName() {
  47. $this->l10n->expects($this->once())
  48. ->method('t')
  49. ->with('Security')
  50. ->willReturn('Sicherheit');
  51. $this->assertEquals('Sicherheit', $this->setting->getName());
  52. }
  53. public function testGetPriority() {
  54. $this->assertEquals(30, $this->setting->getPriority());
  55. }
  56. public function testIsDefaultEnabled() {
  57. $this->assertTrue($this->setting->isDefaultEnabledMail());
  58. $this->assertTrue($this->setting->isDefaultEnabledStream());
  59. }
  60. }