You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SettingTest.php 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. /**
  3. *
  4. *
  5. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  6. * @author Morris Jobke <hey@morrisjobke.de>
  7. * @author Rinat Gumirov <rinat.gumirov@mail.ru>
  8. * @author Roeland Jago Douma <roeland@famdouma.nl>
  9. *
  10. * @license GNU AGPL version 3 or any later version
  11. *
  12. * This program is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License as
  14. * published by the Free Software Foundation, either version 3 of the
  15. * License, or (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU Affero General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Affero General Public License
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  24. *
  25. */
  26. namespace OCA\SystemTags\Tests\Activity;
  27. use OCA\SystemTags\Activity\Setting;
  28. use OCP\IL10N;
  29. use Test\TestCase;
  30. class SettingTest extends TestCase {
  31. /** @var IL10N|\PHPUnit\Framework\MockObject\MockObject */
  32. private $l;
  33. /** @var Setting */
  34. private $setting;
  35. protected function setUp(): void {
  36. parent::setUp();
  37. $this->l = $this->createMock(IL10N::class);
  38. $this->setting = new Setting($this->l);
  39. }
  40. public function testGetIdentifier() {
  41. $this->assertSame('systemtags', $this->setting->getIdentifier());
  42. }
  43. public function testGetName() {
  44. $this->l
  45. ->expects($this->once())
  46. ->method('t')
  47. ->with('<strong>System tags</strong> for a file have been modified')
  48. ->willReturn('<strong>System tags</strong> for a file have been modified');
  49. $this->assertSame('<strong>System tags</strong> for a file have been modified', $this->setting->getName());
  50. }
  51. public function testGetPriority() {
  52. $this->assertSame(50, $this->setting->getPriority());
  53. }
  54. public function testCanChangeStream() {
  55. $this->assertSame(true, $this->setting->canChangeStream());
  56. }
  57. public function testIsDefaultEnabledStream() {
  58. $this->assertSame(true, $this->setting->isDefaultEnabledStream());
  59. }
  60. public function testCanChangeMail() {
  61. $this->assertSame(true, $this->setting->canChangeMail());
  62. }
  63. public function testIsDefaultEnabledMail() {
  64. $this->assertSame(false, $this->setting->isDefaultEnabledMail());
  65. }
  66. }