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 Cepis\Tests;
final class HealthTest extends ServerTestCase
{
public function testReadsHealth(): void
{
$this->server->respond('/health', [self::json([
'status' => 'ok',
'dne' => '26071',
'ceps' => 1596168,
'geo' => 894489,
'base_gerada_em' => '2026-07-24T03:48:28Z',
])]);
$health = $this->client->health();
self::assertTrue($health->isOk());
self::assertSame('26071', $health->dne);
self::assertSame(1596168, $health->ceps);
self::assertSame(894489, $health->geo);
self::assertSame('2026-07-24T03:48:28Z', $health->base_gerada_em);
}
public function testDegradedDoesNotThrow(): void
{
$this->server->respond('/health', [self::json(
['status' => 'degradado', 'dne' => '', 'ceps' => 0, 'geo' => 0],
503,
)]);
$health = $this->client->health();
self::assertFalse($health->isOk());
self::assertSame('degradado', $health->status);
self::assertSame(1, $this->server->countCalls('/health'));
}
}
|