2019-03-19 17:24:16 -04:00
|
|
|
<?php
|
|
|
|
|
/**
|
2024-05-30 14:13:41 -04:00
|
|
|
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2019-03-19 17:24:16 -04:00
|
|
|
*/
|
|
|
|
|
namespace OCA\Theming\Tests\Settings;
|
|
|
|
|
|
2022-04-20 08:21:42 -04:00
|
|
|
use OCA\Theming\AppInfo\Application;
|
|
|
|
|
use OCA\Theming\Settings\AdminSection;
|
2019-03-19 17:24:16 -04:00
|
|
|
use OCP\IL10N;
|
|
|
|
|
use OCP\IURLGenerator;
|
|
|
|
|
use Test\TestCase;
|
|
|
|
|
|
2022-04-29 05:54:25 -04:00
|
|
|
class AdminSectionTest extends TestCase {
|
2020-08-11 15:32:18 -04:00
|
|
|
/** @var IURLGenerator|\PHPUnit\Framework\MockObject\MockObject */
|
2019-03-19 17:24:16 -04:00
|
|
|
private $url;
|
2020-08-11 15:32:18 -04:00
|
|
|
/** @var IL10N|\PHPUnit\Framework\MockObject\MockObject */
|
2019-03-19 17:24:16 -04:00
|
|
|
private $l;
|
2022-04-20 08:21:42 -04:00
|
|
|
/** @var AdminSection */
|
2019-03-19 17:24:16 -04:00
|
|
|
private $section;
|
|
|
|
|
|
2019-11-27 09:27:18 -05:00
|
|
|
protected function setUp(): void {
|
2019-03-19 17:24:16 -04:00
|
|
|
parent::setUp();
|
|
|
|
|
$this->url = $this->createMock(IURLGenerator::class);
|
|
|
|
|
$this->l = $this->createMock(IL10N::class);
|
|
|
|
|
|
2022-04-20 08:21:42 -04:00
|
|
|
$this->section = new AdminSection(
|
|
|
|
|
Application::APP_ID,
|
2019-03-19 17:24:16 -04:00
|
|
|
$this->url,
|
|
|
|
|
$this->l
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testGetID() {
|
|
|
|
|
$this->assertSame('theming', $this->section->getID());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testGetName() {
|
|
|
|
|
$this->l
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('t')
|
|
|
|
|
->with('Theming')
|
|
|
|
|
->willReturn('Theming');
|
|
|
|
|
|
|
|
|
|
$this->assertSame('Theming', $this->section->getName());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testGetPriority() {
|
|
|
|
|
$this->assertSame(30, $this->section->getPriority());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testGetIcon() {
|
|
|
|
|
$this->url->expects($this->once())
|
|
|
|
|
->method('imagePath')
|
|
|
|
|
->with('theming', 'app-dark.svg')
|
|
|
|
|
->willReturn('icon');
|
|
|
|
|
|
|
|
|
|
$this->assertSame('icon', $this->section->getIcon());
|
|
|
|
|
}
|
|
|
|
|
}
|