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.

SectionTest.php 2.0KB

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. * @author szaimen <szaimen@e.mail.de>
  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\Files_External\Tests\Settings;
  27. use OCA\Files_External\Settings\Section;
  28. use OCP\IL10N;
  29. use OCP\IURLGenerator;
  30. use Test\TestCase;
  31. class SectionTest extends TestCase {
  32. /** @var IL10N */
  33. private $l;
  34. /** @var IURLGenerator */
  35. private $urlGenerator;
  36. /** @var Section */
  37. private $section;
  38. protected function setUp(): void {
  39. parent::setUp();
  40. $this->urlGenerator = $this->getMockBuilder(IURLGenerator::class)->disableOriginalConstructor()->getMock();
  41. $this->l = $this->getMockBuilder(IL10N::class)->disableOriginalConstructor()->getMock();
  42. $this->section = new Section(
  43. $this->urlGenerator,
  44. $this->l
  45. );
  46. }
  47. public function testGetID() {
  48. $this->assertSame('externalstorages', $this->section->getID());
  49. }
  50. public function testGetName() {
  51. $this->l
  52. ->expects($this->once())
  53. ->method('t')
  54. ->with('External storage')
  55. ->willReturn('External storage');
  56. $this->assertSame('External storage', $this->section->getName());
  57. }
  58. public function testGetPriority() {
  59. $this->assertSame(10, $this->section->getPriority());
  60. }
  61. }