2016-05-09 04:02:07 -04:00
|
|
|
<?php
|
2024-05-27 11:39:07 -04:00
|
|
|
|
2025-05-13 16:23:39 -04:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
2016-05-09 04:02:07 -04:00
|
|
|
/**
|
2024-05-27 11:39:07 -04:00
|
|
|
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
2016-05-09 04:02:07 -04:00
|
|
|
*/
|
|
|
|
|
namespace OCA\Comments\Tests\Unit\AppInfo;
|
|
|
|
|
|
2025-05-15 02:48:13 -04:00
|
|
|
use OCA\Comments\Activity\Filter;
|
|
|
|
|
use OCA\Comments\Activity\Listener;
|
|
|
|
|
use OCA\Comments\Activity\Provider;
|
|
|
|
|
use OCA\Comments\Activity\Setting;
|
2016-05-09 04:02:07 -04:00
|
|
|
use OCA\Comments\AppInfo\Application;
|
2025-05-15 02:48:13 -04:00
|
|
|
use OCA\Comments\Controller\NotificationsController;
|
2017-03-03 07:12:24 -05:00
|
|
|
use OCA\Comments\Notification\Notifier;
|
2025-02-03 09:34:01 -05:00
|
|
|
use OCP\IUserManager;
|
|
|
|
|
use OCP\IUserSession;
|
|
|
|
|
use OCP\Server;
|
2016-05-09 04:02:07 -04:00
|
|
|
use Test\TestCase;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Class ApplicationTest
|
|
|
|
|
*
|
|
|
|
|
* @package OCA\Comments\Tests\Unit\AppInfo
|
|
|
|
|
*/
|
2025-10-20 19:52:40 -04:00
|
|
|
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
2016-05-09 04:02:07 -04:00
|
|
|
class ApplicationTest extends TestCase {
|
2019-11-21 10:40:38 -05:00
|
|
|
protected function setUp(): void {
|
2016-05-09 04:02:07 -04:00
|
|
|
parent::setUp();
|
2025-02-03 09:34:01 -05:00
|
|
|
Server::get(IUserManager::class)->createUser('dummy', '456');
|
|
|
|
|
Server::get(IUserSession::class)->setUser(Server::get(IUserManager::class)->get('dummy'));
|
2016-05-09 04:02:07 -04:00
|
|
|
}
|
|
|
|
|
|
2019-11-21 10:40:38 -05:00
|
|
|
protected function tearDown(): void {
|
2025-02-03 09:34:01 -05:00
|
|
|
Server::get(IUserManager::class)->get('dummy')->delete();
|
2016-05-09 04:02:07 -04:00
|
|
|
parent::tearDown();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function test(): void {
|
|
|
|
|
$app = new Application();
|
|
|
|
|
$c = $app->getContainer();
|
|
|
|
|
|
|
|
|
|
$services = [
|
2025-05-13 16:23:39 -04:00
|
|
|
NotificationsController::class,
|
|
|
|
|
Filter::class,
|
|
|
|
|
Listener::class,
|
|
|
|
|
Provider::class,
|
|
|
|
|
Setting::class,
|
|
|
|
|
\OCA\Comments\Notification\Listener::class,
|
2017-03-03 07:12:24 -05:00
|
|
|
Notifier::class,
|
2016-05-09 04:02:07 -04:00
|
|
|
];
|
|
|
|
|
|
|
|
|
|
foreach ($services as $service) {
|
2022-03-15 12:17:36 -04:00
|
|
|
$s = $c->get($service);
|
2016-05-09 04:02:07 -04:00
|
|
|
$this->assertInstanceOf($service, $s);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|