diff options
Diffstat (limited to 'apps/theming/tests/Settings/AdminSectionTest.php')
-rw-r--r-- | apps/theming/tests/Settings/AdminSectionTest.php | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/apps/theming/tests/Settings/AdminSectionTest.php b/apps/theming/tests/Settings/AdminSectionTest.php new file mode 100644 index 00000000000..ecb889f264b --- /dev/null +++ b/apps/theming/tests/Settings/AdminSectionTest.php @@ -0,0 +1,60 @@ +<?php + +declare(strict_types=1); +/** + * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +namespace OCA\Theming\Tests\Settings; + +use OCA\Theming\AppInfo\Application; +use OCA\Theming\Settings\AdminSection; +use OCP\IL10N; +use OCP\IURLGenerator; +use PHPUnit\Framework\MockObject\MockObject; +use Test\TestCase; + +class AdminSectionTest extends TestCase { + private IURLGenerator&MockObject $url; + private IL10N&MockObject $l; + private AdminSection $section; + + protected function setUp(): void { + parent::setUp(); + $this->url = $this->createMock(IURLGenerator::class); + $this->l = $this->createMock(IL10N::class); + + $this->section = new AdminSection( + Application::APP_ID, + $this->url, + $this->l + ); + } + + public function testGetID(): void { + $this->assertSame('theming', $this->section->getID()); + } + + public function testGetName(): void { + $this->l + ->expects($this->once()) + ->method('t') + ->with('Theming') + ->willReturn('Theming'); + + $this->assertSame('Theming', $this->section->getName()); + } + + public function testGetPriority(): void { + $this->assertSame(30, $this->section->getPriority()); + } + + public function testGetIcon(): void { + $this->url->expects($this->once()) + ->method('imagePath') + ->with('theming', 'app-dark.svg') + ->willReturn('icon'); + + $this->assertSame('icon', $this->section->getIcon()); + } +} |