ApplicationTest.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OCA\Comments\Tests\Unit\AppInfo;
  8. use OCA\Comments\AppInfo\Application;
  9. use OCA\Comments\Notification\Notifier;
  10. use Test\TestCase;
  11. /**
  12. * Class ApplicationTest
  13. *
  14. * @group DB
  15. *
  16. * @package OCA\Comments\Tests\Unit\AppInfo
  17. */
  18. class ApplicationTest extends TestCase {
  19. protected function setUp(): void {
  20. parent::setUp();
  21. \OC::$server->getUserManager()->createUser('dummy', '456');
  22. \OC::$server->getUserSession()->setUser(\OC::$server->getUserManager()->get('dummy'));
  23. }
  24. protected function tearDown(): void {
  25. \OC::$server->getUserManager()->get('dummy')->delete();
  26. parent::tearDown();
  27. }
  28. public function test(): void {
  29. $app = new Application();
  30. $c = $app->getContainer();
  31. $services = [
  32. 'OCA\Comments\Controller\NotificationsController',
  33. 'OCA\Comments\Activity\Filter',
  34. 'OCA\Comments\Activity\Listener',
  35. 'OCA\Comments\Activity\Provider',
  36. 'OCA\Comments\Activity\Setting',
  37. 'OCA\Comments\Notification\Listener',
  38. Notifier::class,
  39. ];
  40. foreach ($services as $service) {
  41. $s = $c->get($service);
  42. $this->assertInstanceOf($service, $s);
  43. }
  44. }
  45. }