Skip to content

Commit

Permalink
[DEV-17093] Add API health point
Browse files Browse the repository at this point in the history
  • Loading branch information
caddoo committed Aug 24, 2023
1 parent 5c2a47d commit 550d489
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions plugins/API/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ public function getMatomoVersion()
return Version::VERSION;
}

public function getHealthCheck(): array
{
return [
'status' => 'ok'
];
}

/**
* Get PHP version
* @return array
Expand Down
12 changes: 12 additions & 0 deletions plugins/API/tests/Integration/APITest.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ public function test_getBulkRequest_IsAbleToHandleManyDifferentRequests()
$this->assertResponseIsSuccess($response[4]);
}

public function test_getHealthCheck_ReturnsStatusOk(): void
{
$response = $this->api->getHealthCheck();

$this->assertSame(
[
'status' => 'ok'
],
$response
);
}

private function assertResponseIsPermissionError($response)
{
$this->assertSame('error', $response['result']);
Expand Down

0 comments on commit 550d489

Please sign in to comment.