1
0

SectionTest.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
  4. *
  5. * @author Lukas Reschke <lukas@statuscode.ch>
  6. * @author Morris Jobke <hey@morrisjobke.de>
  7. * @author Roeland Jago Douma <roeland@famdouma.nl>
  8. *
  9. * @license GNU AGPL version 3 or any later version
  10. *
  11. * This program is free software: you can redistribute it and/or modify
  12. * it under the terms of the GNU Affero General Public License as
  13. * published by the Free Software Foundation, either version 3 of the
  14. * License, or (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Affero General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Affero General Public License
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  23. *
  24. */
  25. namespace OCA\Files_External\Tests\Settings;
  26. use OCA\Files_External\Settings\Section;
  27. use OCP\IL10N;
  28. use OCP\IURLGenerator;
  29. use Test\TestCase;
  30. class SectionTest extends TestCase {
  31. /** @var IL10N */
  32. private $l;
  33. /** @var IURLGenerator */
  34. private $urlGenerator;
  35. /** @var Section */
  36. private $section;
  37. protected function setUp(): void {
  38. parent::setUp();
  39. $this->urlGenerator = $this->getMockBuilder(IURLGenerator::class)->disableOriginalConstructor()->getMock();
  40. $this->l = $this->getMockBuilder(IL10N::class)->disableOriginalConstructor()->getMock();
  41. $this->section = new Section(
  42. $this->urlGenerator,
  43. $this->l
  44. );
  45. }
  46. public function testGetID() {
  47. $this->assertSame('externalstorages', $this->section->getID());
  48. }
  49. public function testGetName() {
  50. $this->l
  51. ->expects($this->once())
  52. ->method('t')
  53. ->with('External storages')
  54. ->willReturn('External storages');
  55. $this->assertSame('External storages', $this->section->getName());
  56. }
  57. public function testGetPriority() {
  58. $this->assertSame(10, $this->section->getPriority());
  59. }
  60. }