ServicesTest.php 2.4 KB

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