Skip to content

Commit

Permalink
fix http tests
Browse files Browse the repository at this point in the history
  • Loading branch information
transistive committed Oct 9, 2024
1 parent 17725dc commit 8594be4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Http/HttpHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ final class HttpHelper
*/
public static function interpretResponse(ResponseInterface $response): stdClass
{
if ($response->getStatusCode() >= 400) {
if ($response->getStatusCode() >= 500) {
throw new RuntimeException('HTTP Error: '.$response->getReasonPhrase());
}

Expand Down
4 changes: 4 additions & 0 deletions tests/Integration/SummarizedResultFormatterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ public function testAvailableAfter(): void

public function testDateTime(): void
{
if (str_starts_with($_ENV['CONNECTION'] ?? '', 'http')) {
$this->markTestSkipped('http does not support datetime conversion');
}

$dt = new DateTimeImmutable();
$ls = $this->getSession()->run('RETURN $x AS x', ['x' => $dt])->first()->get('x');

Expand Down
18 changes: 14 additions & 4 deletions tests/Integration/TransactionIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,15 @@ public function testCommitInvalid(): void
$exception = null;
try {
$tsx->commit();
} catch (ClientException $e) {
} catch (ClientException|Neo4jException $e) {
$exception = $e;
}
self::assertTrue($exception instanceof ClientException);

if (str_starts_with($_ENV['CONNECTION'] ?? '', 'http')) {
self::assertTrue($exception instanceof Neo4jException);
} else {
self::assertTrue($exception instanceof ClientException);
}

self::assertTrue($tsx->isFinished());
self::assertFalse($tsx->isRolledBack());
Expand Down Expand Up @@ -259,10 +264,15 @@ public function testRollbackInvalid(): void
$exception = null;
try {
$tsx->rollback();
} catch (ClientException $e) {
} catch (ClientException|Neo4jException $e) {
$exception = $e;
}
self::assertTrue($exception instanceof ClientException);

if (str_starts_with($_ENV['CONNECTION'] ?? '', 'http')) {
self::assertTrue($exception instanceof Neo4jException);
} else {
self::assertTrue($exception instanceof ClientException);
}

self::assertTrue($tsx->isFinished());
self::assertTrue($tsx->isRolledBack());
Expand Down

0 comments on commit 8594be4

Please sign in to comment.