ServicesTest.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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\Section;
  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. [Section::class],
  70. [Section::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. }