ServicesTest.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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;
  7. use OCA\Theming\Capabilities;
  8. use OCA\Theming\Controller\ThemingController;
  9. use OCA\Theming\Settings\Admin;
  10. use OCA\Theming\Settings\PersonalSection;
  11. use OCA\Theming\ThemingDefaults;
  12. use OCA\Theming\Util;
  13. use OCP\AppFramework\App;
  14. use OCP\Capabilities\ICapability;
  15. use OCP\IL10N;
  16. use OCP\Settings\IIconSection;
  17. use OCP\Settings\ISettings;
  18. use Test\TestCase;
  19. /**
  20. * Class ServicesTest
  21. *
  22. * @group DB
  23. * @package OCA\Theming\Tests
  24. */
  25. class ServicesTest extends TestCase {
  26. /** @var \OCA\Activity\AppInfo\Application */
  27. protected $app;
  28. /** @var \OCP\AppFramework\IAppContainer */
  29. protected $container;
  30. protected function setUp(): void {
  31. parent::setUp();
  32. $this->app = new App('theming');
  33. $this->container = $this->app->getContainer();
  34. }
  35. public function queryData() {
  36. return [
  37. [IL10N::class],
  38. // lib/
  39. [Capabilities::class],
  40. [Capabilities::class, ICapability::class],
  41. [ThemingDefaults::class],
  42. [ThemingDefaults::class, \OC_Defaults::class],
  43. [Util::class],
  44. // Controller
  45. [ThemingController::class, ThemingController::class],
  46. // Settings
  47. [Admin::class],
  48. [Admin::class, ISettings::class],
  49. [PersonalSection::class],
  50. [PersonalSection::class, IIconSection::class],
  51. ];
  52. }
  53. /**
  54. * @dataProvider queryData
  55. * @param string $service
  56. * @param string $expected
  57. */
  58. public function testContainerQuery($service, $expected = null): void {
  59. if ($expected === null) {
  60. $expected = $service;
  61. }
  62. $this->assertTrue($this->container->query($service) instanceof $expected);
  63. }
  64. }