ApplicationTest.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OCA\Settings\Tests\AppInfo;
  7. use OCA\Settings\AppInfo\Application;
  8. use OCA\Settings\Controller\AdminSettingsController;
  9. use OCA\Settings\Controller\AppSettingsController;
  10. use OCA\Settings\Controller\AuthSettingsController;
  11. use OCA\Settings\Controller\CheckSetupController;
  12. use OCA\Settings\Controller\LogSettingsController;
  13. use OCA\Settings\Controller\MailSettingsController;
  14. use OCA\Settings\Controller\UsersController;
  15. use OCA\Settings\Middleware\SubadminMiddleware;
  16. use OCP\AppFramework\Controller;
  17. use OCP\AppFramework\IAppContainer;
  18. use OCP\AppFramework\Middleware;
  19. use Test\TestCase;
  20. /**
  21. * Class ApplicationTest
  22. *
  23. * @package Tests\Settings
  24. * @group DB
  25. */
  26. class ApplicationTest extends TestCase {
  27. /** @var Application */
  28. protected $app;
  29. /** @var IAppContainer */
  30. protected $container;
  31. protected function setUp(): void {
  32. parent::setUp();
  33. $this->app = new Application();
  34. $this->container = $this->app->getContainer();
  35. }
  36. public function testContainerAppName() {
  37. $this->app = new Application();
  38. $this->assertEquals('settings', $this->container->getAppName());
  39. }
  40. public function dataContainerQuery() {
  41. return [
  42. [AdminSettingsController::class, Controller::class],
  43. [AppSettingsController::class, Controller::class],
  44. [AuthSettingsController::class, Controller::class],
  45. [CheckSetupController::class, Controller::class],
  46. [LogSettingsController::class, Controller::class],
  47. [MailSettingsController::class, Controller::class],
  48. [UsersController::class, Controller::class],
  49. [SubadminMiddleware::class, Middleware::class],
  50. ];
  51. }
  52. /**
  53. * @dataProvider dataContainerQuery
  54. * @param string $service
  55. * @param string $expected
  56. */
  57. public function testContainerQuery($service, $expected) {
  58. $this->assertTrue($this->container->query($service) instanceof $expected);
  59. }
  60. }