ServicesTest.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016 Joas Schilling <coding@schilljs.com>
  4. *
  5. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  6. * @author Joas Schilling <coding@schilljs.com>
  7. * @author Morris Jobke <hey@morrisjobke.de>
  8. * @author Roeland Jago Douma <roeland@famdouma.nl>
  9. *
  10. * @license GNU AGPL version 3 or any later version
  11. *
  12. * This program is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License as
  14. * published by the Free Software Foundation, either version 3 of the
  15. * License, or (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU Affero General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Affero General Public License
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  24. *
  25. */
  26. namespace OCA\Theming\Tests;
  27. use OCA\Theming\Capabilities;
  28. use OCA\Theming\Controller\ThemingController;
  29. use OCA\Theming\Settings\Admin;
  30. use OCA\Theming\Settings\PersonalSection;
  31. use OCA\Theming\ThemingDefaults;
  32. use OCA\Theming\Util;
  33. use OCP\AppFramework\App;
  34. use OCP\Capabilities\ICapability;
  35. use OCP\IL10N;
  36. use OCP\Settings\IIconSection;
  37. use OCP\Settings\ISettings;
  38. use Test\TestCase;
  39. /**
  40. * Class ServicesTest
  41. *
  42. * @group DB
  43. * @package OCA\Theming\Tests
  44. */
  45. class ServicesTest extends TestCase {
  46. /** @var \OCA\Activity\AppInfo\Application */
  47. protected $app;
  48. /** @var \OCP\AppFramework\IAppContainer */
  49. protected $container;
  50. protected function setUp(): void {
  51. parent::setUp();
  52. $this->app = new App('theming');
  53. $this->container = $this->app->getContainer();
  54. }
  55. public function queryData() {
  56. return [
  57. [IL10N::class],
  58. // lib/
  59. [Capabilities::class],
  60. [Capabilities::class, ICapability::class],
  61. [ThemingDefaults::class],
  62. [ThemingDefaults::class, \OC_Defaults::class],
  63. [Util::class],
  64. // Controller
  65. [ThemingController::class, ThemingController::class],
  66. // Settings
  67. [Admin::class],
  68. [Admin::class, ISettings::class],
  69. [PersonalSection::class],
  70. [PersonalSection::class, IIconSection::class],
  71. ];
  72. }
  73. /**
  74. * @dataProvider queryData
  75. * @param string $service
  76. * @param string $expected
  77. */
  78. public function testContainerQuery($service, $expected = null) {
  79. if ($expected === null) {
  80. $expected = $service;
  81. }
  82. $this->assertTrue($this->container->query($service) instanceof $expected);
  83. }
  84. }