1
0

ApplicationTest.php 2.1 KB

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