aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDaniel Kesselberg <mail@danielkesselberg.de>2023-05-21 23:05:40 +0200
committerDaniel Kesselberg <mail@danielkesselberg.de>2023-06-03 21:42:51 +0200
commita2afc7b6a9b42598cadcc3d3e9dde80e0a8a9ce4 (patch)
tree214512080370ac8ce227ab60a6f331163db045da /tests
parent2fd7febffd0ade3f33c8833126c2b8eceabc5d14 (diff)
downloadnextcloud-server-a2afc7b6a9b42598cadcc3d3e9dde80e0a8a9ce4.tar.gz
nextcloud-server-a2afc7b6a9b42598cadcc3d3e9dde80e0a8a9ce4.zip
refactor: migrate OC_EventSource to dependency injection
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/EventSourceFactoryTest.php37
-rw-r--r--tests/lib/ServerTest.php5
2 files changed, 37 insertions, 5 deletions
diff --git a/tests/lib/EventSourceFactoryTest.php b/tests/lib/EventSourceFactoryTest.php
new file mode 100644
index 00000000000..67bc900bd4c
--- /dev/null
+++ b/tests/lib/EventSourceFactoryTest.php
@@ -0,0 +1,37 @@
+<?php
+/**
+ * @copyright Copyright (c) 2023 Daniel Kesselberg <mail@danielkesselberg.de>
+ *
+ * @author Daniel Kesselberg <mail@danielkesselberg.de>
+ *
+ * @license AGPL-3.0-or-later
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace Test;
+
+use OC\EventSourceFactory;
+use OCP\IEventSource;
+use OCP\IRequest;
+
+class EventSourceFactoryTest extends TestCase {
+ public function testCreate(): void {
+ $request = $this->createMock(IRequest::class);
+ $factory = new EventSourceFactory($request);
+
+ $instance = $factory->create();
+ $this->assertInstanceOf(IEventSource::class, $instance);
+ }
+}
diff --git a/tests/lib/ServerTest.php b/tests/lib/ServerTest.php
index cbaa0e0762a..d9f95e9eab1 100644
--- a/tests/lib/ServerTest.php
+++ b/tests/lib/ServerTest.php
@@ -179,11 +179,6 @@ class ServerTest extends \Test\TestCase {
$this->assertInstanceOf('\OCP\ICertificateManager', $this->server->getCertificateManager(), 'service returned by "getCertificateManager" did not return the right class');
}
- public function testCreateEventSource() {
- $this->assertInstanceOf('\OC_EventSource', $this->server->createEventSource(), 'service returned by "createEventSource" did not return the right class');
- $this->assertInstanceOf('\OCP\IEventSource', $this->server->createEventSource(), 'service returned by "createEventSource" did not return the right class');
- }
-
public function testOverwriteDefaultCommentsManager() {
$config = $this->server->getConfig();
$defaultManagerFactory = $config->getSystemValue('comments.managerFactory', '\OC\Comments\ManagerFactory');