1
0

AdminSectionTest.php 2.1 KB

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