diff --git a/src/Connection.php b/src/Connection.php index cce4336..b191382 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -296,4 +296,20 @@ public function threadCount() return $this->arangoClient->monitor()->getCurrentConnections(); } + + /** + * Get the server version for the connection. + * + * @return string + */ + public function getServerVersion(): string + { + if (!$this->arangoClient) { + return ''; + } + + $rawVersion = $this->arangoClient->admin()->getVersion(); + + return $rawVersion->version; + } } diff --git a/tests/Database/ConnectionTest.php b/tests/Database/ConnectionTest.php index 378a0d2..0958b7b 100644 --- a/tests/Database/ConnectionTest.php +++ b/tests/Database/ConnectionTest.php @@ -130,3 +130,10 @@ expect($connection->threadCount())->toBeInt(); expect($connection->threadCount())->toBeGreaterThan(-1); }); + +test('getServerVersion', function () { + $connection = $this->connection; + + expect($connection->getServerVersion())->toBeString(); + expect($connection->getServerVersion())->toMatch('/^\d+\.\d+\.\d+$/i'); +});