aboutsummaryrefslogtreecommitdiffstats
path: root/apps/comments/tests/Unit/AppInfo/ApplicationTest.php
blob: 4b87982ab4511d2e2fe5995b2ecf6cf59b13200a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php

/**
 * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
 * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
 * SPDX-License-Identifier: AGPL-3.0-only
 */
namespace OCA\Comments\Tests\Unit\AppInfo;

use OCA\Comments\AppInfo\Application;
use OCA\Comments\Notification\Notifier;
use Test\TestCase;

/**
 * Class ApplicationTest
 *
 * @group DB
 *
 * @package OCA\Comments\Tests\Unit\AppInfo
 */
class ApplicationTest extends TestCase {
	protected function setUp(): void {
		parent::setUp();
		\OC::$server->getUserManager()->createUser('dummy', '456');
		\OC::$server->getUserSession()->setUser(\OC::$server->getUserManager()->get('dummy'));
	}

	protected function tearDown(): void {
		\OC::$server->getUserManager()->get('dummy')->delete();
		parent::tearDown();
	}

	public function test(): void {
		$app = new Application();
		$c = $app->getContainer();

		$services = [
			'OCA\Comments\Controller\NotificationsController',
			'OCA\Comments\Activity\Filter',
			'OCA\Comments\Activity\Listener',
			'OCA\Comments\Activity\Provider',
			'OCA\Comments\Activity\Setting',
			'OCA\Comments\Notification\Listener',
			Notifier::class,
		];

		foreach ($services as $service) {
			$s = $c->get($service);
			$this->assertInstanceOf($service, $s);
		}
	}
}