summaryrefslogtreecommitdiff
path: root/tests/ServerImplementationTest.php
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2025-08-12 18:02:39 +0200
committerDaniel Weipert <git@mail.dweipert.de>2025-08-12 18:02:45 +0200
commit5ab89da146929734a39c7a55619b8bf8298ab832 (patch)
tree48746c1320b274f3c00f7c45aa7e512743e1ef75 /tests/ServerImplementationTest.php
parent1fc29c6029cfa8c7dce5535ff9cfb2daaa6427e0 (diff)
implement phpunit integration tests
Diffstat (limited to 'tests/ServerImplementationTest.php')
-rw-r--r--tests/ServerImplementationTest.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/ServerImplementationTest.php b/tests/ServerImplementationTest.php
new file mode 100644
index 0000000..88be7c4
--- /dev/null
+++ b/tests/ServerImplementationTest.php
@@ -0,0 +1,36 @@
+<?php
+
+namespace Tests;
+
+use Symfony\Component\HttpFoundation\Response;
+use Tests\PHPUnit\TestCases\HttpResponseTestCase;
+
+class ServerImplementationTest extends HttpResponseTestCase
+{
+ public function testVersion(): void
+ {
+ $response = $this->request("GET", "/_matrix/federation/v1/version");
+
+ $this->assertEquals(Response::HTTP_OK, $response->getStatusCode());
+ $this->assertTrue($this->hasJsonBody($response));
+
+ $body = json_decode((string)$response->getBody(), true);
+
+ $this->assertArrayHasKey("server", $body);
+ $this->assertArrayHasKey("name", $body["server"]);
+ $this->assertArrayHasKey("version", $body["server"]);
+ }
+
+ public function testVersions(): void
+ {
+ $response = $this->request("GET", "/_matrix/client/versions");
+
+ $this->assertEquals(Response::HTTP_OK, $response->getStatusCode());
+ $this->assertTrue($this->hasJsonBody($response));
+
+ $body = json_decode((string)$response->getBody(), true);
+
+ $this->assertIsArray($body["versions"]);
+ $this->assertTrue(count($body["versions"]) > 0);
+ }
+}