From 124496275d7158cbe7697f5d4f51c907c3d76545 Mon Sep 17 00:00:00 2001 From: tienvx Date: Mon, 6 Mar 2023 13:08:15 +0700 Subject: [PATCH] Test stub server health check --- .../StubService/Service/StubServerHttpService.php | 2 +- .../StubServer/Service/StubServerHttpServiceTest.php | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/PhpPact/Standalone/StubService/Service/StubServerHttpService.php b/src/PhpPact/Standalone/StubService/Service/StubServerHttpService.php index b3b98fed..66790d0f 100644 --- a/src/PhpPact/Standalone/StubService/Service/StubServerHttpService.php +++ b/src/PhpPact/Standalone/StubService/Service/StubServerHttpService.php @@ -53,7 +53,7 @@ public function healthCheck(): bool $body = $response->getBody()->getContents(); if ($response->getStatusCode() !== 200 - || $body !== "Stub service running\n") { + || $body !== "Mock service running\n") { throw new ConnectionException('Failed to receive a successful response from the Stub Server.'); } diff --git a/tests/PhpPact/Standalone/StubServer/Service/StubServerHttpServiceTest.php b/tests/PhpPact/Standalone/StubServer/Service/StubServerHttpServiceTest.php index bc580efa..2990bd58 100644 --- a/tests/PhpPact/Standalone/StubServer/Service/StubServerHttpServiceTest.php +++ b/tests/PhpPact/Standalone/StubServer/Service/StubServerHttpServiceTest.php @@ -49,6 +49,12 @@ protected function tearDown(): void $this->stubServer->stop(); } + public function testHealthCheck() + { + $result = $this->service->healthCheck(); + $this->assertTrue($result); + } + public function testGetJson() { $result = $this->service->getJson();