Skip to content

Commit 772ee90

Browse files
committed
fix http tests
1 parent ccb3207 commit 772ee90

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

src/Http/HttpHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ final class HttpHelper
4949
*/
5050
public static function interpretResponse(ResponseInterface $response): stdClass
5151
{
52-
if ($response->getStatusCode() >= 400) {
52+
if ($response->getStatusCode() >= 500) {
5353
throw new RuntimeException('HTTP Error: '.$response->getReasonPhrase());
5454
}
5555

tests/Integration/SummarizedResultFormatterTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ public function testAvailableAfter(): void
104104

105105
public function testDateTime(): void
106106
{
107+
if (str_starts_with($_ENV['CONNECTION'] ?? '', 'http')) {
108+
$this->markTestSkipped('http does not support datetime conversion');
109+
}
110+
107111
$dt = new DateTimeImmutable();
108112
$ls = $this->getSession()->run('RETURN $x AS x', ['x' => $dt])->first()->get('x');
109113

tests/Integration/TransactionIntegrationTest.php

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,15 @@ public function testCommitInvalid(): void
226226
$exception = null;
227227
try {
228228
$tsx->commit();
229-
} catch (ClientException $e) {
229+
} catch (ClientException|Neo4jException $e) {
230230
$exception = $e;
231231
}
232-
self::assertTrue($exception instanceof ClientException);
232+
233+
if (str_starts_with($_ENV['CONNECTION'] ?? '', 'http')) {
234+
self::assertTrue($exception instanceof Neo4jException);
235+
} else {
236+
self::assertTrue($exception instanceof ClientException);
237+
}
233238

234239
self::assertTrue($tsx->isFinished());
235240
self::assertFalse($tsx->isRolledBack());
@@ -259,10 +264,15 @@ public function testRollbackInvalid(): void
259264
$exception = null;
260265
try {
261266
$tsx->rollback();
262-
} catch (ClientException $e) {
267+
} catch (ClientException|Neo4jException $e) {
263268
$exception = $e;
264269
}
265-
self::assertTrue($exception instanceof ClientException);
270+
271+
if (str_starts_with($_ENV['CONNECTION'] ?? '', 'http')) {
272+
self::assertTrue($exception instanceof Neo4jException);
273+
} else {
274+
self::assertTrue($exception instanceof ClientException);
275+
}
266276

267277
self::assertTrue($tsx->isFinished());
268278
self::assertTrue($tsx->isRolledBack());

0 commit comments

Comments
 (0)