1
0

SecuritySettingTest.php 1.9 KB

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