-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathPingRequestHandlerTest.php
More file actions
41 lines (31 loc) · 1.12 KB
/
PingRequestHandlerTest.php
File metadata and controls
41 lines (31 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
declare(strict_types=1);
namespace App\Tests\Integration;
/**
* @internal
*
* @coversNothing
*/
final class PingRequestHandlerTest extends AbstractIntegrationTestCase
{
public function testPing(): void
{
$now = \DateTimeImmutable::createFromFormat(\DateTime::ATOM, date('c'));
$response = $this->httpRequest(
'GET',
'/ping',
[
'Accept' => 'application/json',
]
);
self::assertSame(200, $response['status']['code'], $response['body'] ?? '');
self::assertSame('application/json', $response['headers']['content-type'][0]);
self::assertSame('no-cache, no-store, must-revalidate', $response['headers']['cache-control'][0]);
self::assertSame('0', $response['headers']['expires'][0]);
self::assertSame('no-cache', $response['headers']['pragma'][0]);
$ping = json_decode($response['body'], true, 512, JSON_THROW_ON_ERROR);
self::assertArrayHasKey('datetime', $ping);
$date = new \DateTimeImmutable($ping['datetime']);
self::assertGreaterThanOrEqual($now, $date);
}
}