diff options
Diffstat (limited to 'tests/Integration/ServerImplementationTest.php')
-rw-r--r-- | tests/Integration/ServerImplementationTest.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/Integration/ServerImplementationTest.php b/tests/Integration/ServerImplementationTest.php new file mode 100644 index 0000000..c1c1823 --- /dev/null +++ b/tests/Integration/ServerImplementationTest.php @@ -0,0 +1,36 @@ +<?php + +namespace Tests\Integration; + +use Symfony\Component\HttpFoundation\Response; +use Tests\Integration\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); + } +} |