diff options
| author | Murilo Ijanc <[email protected]> | 2026-07-26 14:58:55 -0300 |
|---|---|---|
| committer | Murilo Ijanc <[email protected]> | 2026-07-26 14:58:55 -0300 |
| commit | 64764fb9fac0227f8e0443e7c7519d73aec275b9 (patch) | |
| tree | cb4fc56eeb6ecce53854f9c530609cf01ab3349f /tests/HealthTest.php | |
| download | php-64764fb9fac0227f8e0443e7c7519d73aec275b9.tar.gz | |
Initial importv0.1.0
Diffstat (limited to 'tests/HealthTest.php')
| -rw-r--r-- | tests/HealthTest.php | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/HealthTest.php b/tests/HealthTest.php new file mode 100644 index 0000000..08c047b --- /dev/null +++ b/tests/HealthTest.php @@ -0,0 +1,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')); + } +} |