From 5ab89da146929734a39c7a55619b8bf8298ab832 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Tue, 12 Aug 2025 18:02:39 +0200 Subject: implement phpunit integration tests --- tests/ServerImplementationTest.php | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 tests/ServerImplementationTest.php (limited to 'tests/ServerImplementationTest.php') 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 @@ +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); + } +} -- cgit v1.2.3