2020-11-23 14:31:50 +00:00
|
|
|
<?php
|
|
|
|
/** @license MIT
|
|
|
|
* Copyright 2017 J. King, Dustin Wilson et al.
|
|
|
|
* See LICENSE and AUTHORS files for details */
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace JKingWeb\Arsse\TestCase\REST\Miniflux;
|
|
|
|
|
2022-08-05 02:04:39 +00:00
|
|
|
use JKingWeb\Arsse\Misc\HTTP;
|
2020-11-23 14:31:50 +00:00
|
|
|
use JKingWeb\Arsse\REST\Miniflux\Status;
|
|
|
|
use JKingWeb\Arsse\REST\Miniflux\V1;
|
|
|
|
use Psr\Http\Message\ResponseInterface;
|
|
|
|
|
|
|
|
/** @covers \JKingWeb\Arsse\REST\Miniflux\Status */
|
|
|
|
class TestStatus extends \JKingWeb\Arsse\Test\AbstractTest {
|
|
|
|
/** @dataProvider provideRequests */
|
|
|
|
public function testAnswerStatusRequests(string $url, string $method, ResponseInterface $exp): void {
|
|
|
|
$act = (new Status)->dispatch($this->serverRequest($method, $url, ""));
|
|
|
|
$this->assertMessage($exp, $act);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function provideRequests(): iterable {
|
|
|
|
return [
|
2022-08-06 20:03:50 +00:00
|
|
|
["/version", "GET", HTTP::respText(V1::VERSION)],
|
2022-08-05 02:04:39 +00:00
|
|
|
["/version", "POST", HTTP::respEmpty(405, ['Allow' => "HEAD, GET"])],
|
|
|
|
["/version", "OPTIONS", HTTP::respEmpty(204, ['Allow' => "HEAD, GET"])],
|
2022-08-06 20:03:50 +00:00
|
|
|
["/healthcheck", "GET", HTTP::respText("OK")],
|
2022-08-05 02:04:39 +00:00
|
|
|
["/healthcheck", "POST", HTTP::respEmpty(405, ['Allow' => "HEAD, GET"])],
|
|
|
|
["/healthcheck", "OPTIONS", HTTP::respEmpty(204, ['Allow' => "HEAD, GET"])],
|
|
|
|
["/version/", "GET", HTTP::respEmpty(404)],
|
2020-11-23 14:31:50 +00:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|