2016-09-06 02:55:22 -04:00
|
|
|
<?php
|
2025-05-20 17:04:05 -04:00
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
2016-09-06 02:55:22 -04:00
|
|
|
/**
|
2024-05-30 14:13:41 -04:00
|
|
|
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2016-09-06 02:55:22 -04:00
|
|
|
*/
|
|
|
|
|
namespace OCA\Theming\Tests;
|
|
|
|
|
|
|
|
|
|
use OCA\Theming\Capabilities;
|
|
|
|
|
use OCA\Theming\Controller\ThemingController;
|
|
|
|
|
use OCA\Theming\Settings\Admin;
|
2022-04-20 08:21:42 -04:00
|
|
|
use OCA\Theming\Settings\PersonalSection;
|
2016-09-06 02:55:22 -04:00
|
|
|
use OCA\Theming\ThemingDefaults;
|
|
|
|
|
use OCA\Theming\Util;
|
|
|
|
|
use OCP\AppFramework\App;
|
2024-10-18 06:04:22 -04:00
|
|
|
use OCP\AppFramework\IAppContainer;
|
2016-09-06 02:55:22 -04:00
|
|
|
use OCP\Capabilities\ICapability;
|
|
|
|
|
use OCP\IL10N;
|
2020-10-28 17:51:49 -04:00
|
|
|
use OCP\Settings\IIconSection;
|
2016-09-06 02:55:22 -04:00
|
|
|
use OCP\Settings\ISettings;
|
|
|
|
|
use Test\TestCase;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Class ServicesTest
|
|
|
|
|
*
|
|
|
|
|
* @package OCA\Theming\Tests
|
|
|
|
|
*/
|
2026-01-07 08:21:48 -05:00
|
|
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
2016-09-06 02:55:22 -04:00
|
|
|
class ServicesTest extends TestCase {
|
2025-05-20 17:04:05 -04:00
|
|
|
protected App $app;
|
2016-09-06 02:55:22 -04:00
|
|
|
|
2025-05-20 17:04:05 -04:00
|
|
|
protected IAppContainer $container;
|
2016-09-06 02:55:22 -04:00
|
|
|
|
2019-11-21 10:40:38 -05:00
|
|
|
protected function setUp(): void {
|
2016-09-06 02:55:22 -04:00
|
|
|
parent::setUp();
|
|
|
|
|
$this->app = new App('theming');
|
|
|
|
|
$this->container = $this->app->getContainer();
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-20 17:04:05 -04:00
|
|
|
public static function queryData(): array {
|
2016-09-06 02:55:22 -04:00
|
|
|
return [
|
|
|
|
|
[IL10N::class],
|
|
|
|
|
|
|
|
|
|
// lib/
|
|
|
|
|
[Capabilities::class],
|
|
|
|
|
[Capabilities::class, ICapability::class],
|
|
|
|
|
[ThemingDefaults::class],
|
|
|
|
|
[ThemingDefaults::class, \OC_Defaults::class],
|
|
|
|
|
[Util::class],
|
|
|
|
|
|
|
|
|
|
// Controller
|
|
|
|
|
[ThemingController::class, ThemingController::class],
|
|
|
|
|
|
|
|
|
|
// Settings
|
|
|
|
|
[Admin::class],
|
|
|
|
|
[Admin::class, ISettings::class],
|
2022-04-20 08:21:42 -04:00
|
|
|
[PersonalSection::class],
|
|
|
|
|
[PersonalSection::class, IIconSection::class],
|
2016-09-06 02:55:22 -04:00
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-07 08:21:48 -05:00
|
|
|
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'queryData')]
|
2025-05-20 17:04:05 -04:00
|
|
|
public function testContainerQuery(string $service, ?string $expected = null): void {
|
2016-09-06 02:55:22 -04:00
|
|
|
if ($expected === null) {
|
|
|
|
|
$expected = $service;
|
|
|
|
|
}
|
2025-05-20 17:04:05 -04:00
|
|
|
$this->assertInstanceOf($expected, $this->container->query($service));
|
2016-09-06 02:55:22 -04:00
|
|
|
}
|
|
|
|
|
}
|