From c365eb5abf45cd1a8944a1c89fe9187946322379 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20Fabr=C3=A9gat?= Date: Thu, 5 Dec 2024 17:55:02 -0800 Subject: [PATCH] Update WatermarkerClientTest.php --- tests/WatermarkerClientTest.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/WatermarkerClientTest.php b/tests/WatermarkerClientTest.php index 6a1342c..c8255d6 100644 --- a/tests/WatermarkerClientTest.php +++ b/tests/WatermarkerClientTest.php @@ -29,7 +29,22 @@ final class WatermarkerClientTest extends TestCase private const string DEFAULT_WATERMARKER_BASE_URL = 'http://localhost:3000'; private const string TEST_IMG_PATH = __DIR__.'/assets/doc.png'; private const string TEST_WATERMARK_PATH = __DIR__.'/assets/watermark.png'; - private const string TEST_RESULT_PATH = __DIR__.'/assets/watermarked.jpg'; + private const string TEST_RESULT_PATH = '/tmp/watermarked.jpg'; + + public function testHealth(): void + { + // testing a healthy service + $client = $this->getNewClient(); + $this->assertNotFalse($client->checkServiceHealth(), "The service is not healthy."); + + // testing a non-existing service + $client = new WatermarkerClient('https://example.com'); + $this->assertFalse($client->checkServiceHealth(), "The service is healthy."); + + // testing a non-existing url + $client = new WatermarkerClient('https://example-NQrkB6F6MwuXesMrBhqx.com'); + $this->assertFalse($client->checkServiceHealth(), "The service is healthy."); + } /** * @throws Exception