SectionTest.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OCA\Files_External\Tests\Settings;
  7. use OCA\Files_External\Settings\Section;
  8. use OCP\IL10N;
  9. use OCP\IURLGenerator;
  10. use Test\TestCase;
  11. class SectionTest extends TestCase {
  12. /** @var IL10N */
  13. private $l;
  14. /** @var IURLGenerator */
  15. private $urlGenerator;
  16. /** @var Section */
  17. private $section;
  18. protected function setUp(): void {
  19. parent::setUp();
  20. $this->urlGenerator = $this->getMockBuilder(IURLGenerator::class)->disableOriginalConstructor()->getMock();
  21. $this->l = $this->getMockBuilder(IL10N::class)->disableOriginalConstructor()->getMock();
  22. $this->section = new Section(
  23. $this->urlGenerator,
  24. $this->l
  25. );
  26. }
  27. public function testGetID(): void {
  28. $this->assertSame('externalstorages', $this->section->getID());
  29. }
  30. public function testGetName(): void {
  31. $this->l
  32. ->expects($this->once())
  33. ->method('t')
  34. ->with('External storage')
  35. ->willReturn('External storage');
  36. $this->assertSame('External storage', $this->section->getName());
  37. }
  38. public function testGetPriority(): void {
  39. $this->assertSame(10, $this->section->getPriority());
  40. }
  41. }