From 5ab89da146929734a39c7a55619b8bf8298ab832 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Tue, 12 Aug 2025 18:02:39 +0200 Subject: implement phpunit integration tests --- tests/PHPUnit/TestCases/HttpResponseTestCase.php | 37 ++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 tests/PHPUnit/TestCases/HttpResponseTestCase.php (limited to 'tests/PHPUnit/TestCases') diff --git a/tests/PHPUnit/TestCases/HttpResponseTestCase.php b/tests/PHPUnit/TestCases/HttpResponseTestCase.php new file mode 100644 index 0000000..855e594 --- /dev/null +++ b/tests/PHPUnit/TestCases/HttpResponseTestCase.php @@ -0,0 +1,37 @@ +client = new Client([ + "base_uri" => "http://localhost:8080", + ]); + } + + /** + * @param array $options + */ + public function request(string $method, string $path, array $options = []): Response + { + return $this->client->request( + $method, + $path, + ["http_errors" => false] + $options + ); + } + + public function hasJsonBody(Response $response): bool + { + json_decode((string)$response->getBody()); + return json_last_error() === JSON_ERROR_NONE; + } +} -- cgit v1.2.3