You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ApplicationTest.php 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
  6. * @author Joas Schilling <coding@schilljs.com>
  7. * @author Roeland Jago Douma <roeland@famdouma.nl>
  8. *
  9. * @license AGPL-3.0
  10. *
  11. * This code is free software: you can redistribute it and/or modify
  12. * it under the terms of the GNU Affero General Public License, version 3,
  13. * as published by the Free Software Foundation.
  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, version 3,
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>
  22. *
  23. */
  24. namespace OCA\Comments\Tests\Unit\AppInfo;
  25. use OCA\Comments\AppInfo\Application;
  26. use OCA\Comments\Notification\Notifier;
  27. use Test\TestCase;
  28. /**
  29. * Class ApplicationTest
  30. *
  31. * @group DB
  32. *
  33. * @package OCA\Comments\Tests\Unit\AppInfo
  34. */
  35. class ApplicationTest extends TestCase {
  36. protected function setUp(): void {
  37. parent::setUp();
  38. \OC::$server->getUserManager()->createUser('dummy', '456');
  39. \OC::$server->getUserSession()->setUser(\OC::$server->getUserManager()->get('dummy'));
  40. }
  41. protected function tearDown(): void {
  42. \OC::$server->getUserManager()->get('dummy')->delete();
  43. parent::tearDown();
  44. }
  45. public function test() {
  46. $app = new Application();
  47. $c = $app->getContainer();
  48. // assert service instances in the container are properly setup
  49. $s = $c->query('NotificationsController');
  50. $this->assertInstanceOf('OCA\Comments\Controller\Notifications', $s);
  51. $services = [
  52. 'OCA\Comments\Activity\Filter',
  53. 'OCA\Comments\Activity\Listener',
  54. 'OCA\Comments\Activity\Provider',
  55. 'OCA\Comments\Activity\Setting',
  56. 'OCA\Comments\Notification\Listener',
  57. Notifier::class,
  58. ];
  59. foreach ($services as $service) {
  60. $s = $c->query($service);
  61. $this->assertInstanceOf($service, $s);
  62. }
  63. }
  64. }