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