1
0

ServicesTest.php 2.3 KB

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