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.

CalDAVSettingsTest.php 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. /**
  3. * @copyright 2017, Georg Ehrke <oc.list@georgehrke.com>
  4. *
  5. * @author Georg Ehrke <oc.list@georgehrke.com>
  6. * @author Julius Härtl <jus@bitgrid.net>
  7. * @author Morris Jobke <hey@morrisjobke.de>
  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\DAV\Tests\Unit\DAV\Settings;
  27. use OCA\DAV\Settings\CalDAVSettings;
  28. use OCP\IConfig;
  29. use OCP\AppFramework\Services\IInitialState;
  30. use Test\TestCase;
  31. class CalDAVSettingsTest extends TestCase {
  32. /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
  33. private $config;
  34. /** @var OCP\AppFramework\Services\IInitialState|\PHPUnit\Framework\MockObject\MockObject */
  35. private $initialState;
  36. /** @var CalDAVSettings */
  37. private $settings;
  38. protected function setUp(): void {
  39. parent::setUp();
  40. $this->config = $this->createMock(IConfig::class);
  41. $this->initialState = $this->createMock(IInitialState::class);
  42. $this->settings = new CalDAVSettings($this->config, $this->initialState);
  43. }
  44. public function testGetForm() {
  45. $this->config->method('getAppValue')
  46. ->withConsecutive(
  47. ['dav', 'sendInvitations', 'yes'],
  48. ['dav', 'generateBirthdayCalendar', 'yes'],
  49. ['dav', 'sendEventReminders', 'yes'],
  50. ['dav', 'sendEventRemindersPush', 'no'],
  51. )
  52. ->will($this->onConsecutiveCalls('yes', 'no', 'yes', 'yes'));
  53. $this->initialState->method('provideInitialState')
  54. ->withConsecutive(
  55. ['sendInvitations', true],
  56. ['generateBirthdayCalendar', false],
  57. ['sendEventReminders', true],
  58. ['sendEventRemindersPush', true],
  59. );
  60. $result = $this->settings->getForm();
  61. $this->assertInstanceOf('OCP\AppFramework\Http\TemplateResponse', $result);
  62. }
  63. public function testGetSection() {
  64. $this->assertEquals('groupware', $this->settings->getSection());
  65. }
  66. public function testGetPriority() {
  67. $this->assertEquals(10, $this->settings->getPriority());
  68. }
  69. }