1
0

AdminSectionTest.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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\Theming\Tests\Settings;
  7. use OCA\Theming\AppInfo\Application;
  8. use OCA\Theming\Settings\AdminSection;
  9. use OCP\IL10N;
  10. use OCP\IURLGenerator;
  11. use Test\TestCase;
  12. class AdminSectionTest extends TestCase {
  13. /** @var IURLGenerator|\PHPUnit\Framework\MockObject\MockObject */
  14. private $url;
  15. /** @var IL10N|\PHPUnit\Framework\MockObject\MockObject */
  16. private $l;
  17. /** @var AdminSection */
  18. private $section;
  19. protected function setUp(): void {
  20. parent::setUp();
  21. $this->url = $this->createMock(IURLGenerator::class);
  22. $this->l = $this->createMock(IL10N::class);
  23. $this->section = new AdminSection(
  24. Application::APP_ID,
  25. $this->url,
  26. $this->l
  27. );
  28. }
  29. public function testGetID(): void {
  30. $this->assertSame('theming', $this->section->getID());
  31. }
  32. public function testGetName(): void {
  33. $this->l
  34. ->expects($this->once())
  35. ->method('t')
  36. ->with('Theming')
  37. ->willReturn('Theming');
  38. $this->assertSame('Theming', $this->section->getName());
  39. }
  40. public function testGetPriority(): void {
  41. $this->assertSame(30, $this->section->getPriority());
  42. }
  43. public function testGetIcon(): void {
  44. $this->url->expects($this->once())
  45. ->method('imagePath')
  46. ->with('theming', 'app-dark.svg')
  47. ->willReturn('icon');
  48. $this->assertSame('icon', $this->section->getIcon());
  49. }
  50. }