Skip to content

Commit 3d3f0cb

Browse files
committed
setup tests for datetimes
1 parent 6de8be4 commit 3d3f0cb

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/Formatter/OGMFormatter.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
use Laudis\Neo4j\Types\CypherMap;
3232
use Laudis\Neo4j\Types\Date;
3333
use Laudis\Neo4j\Types\DateTime;
34+
use Laudis\Neo4j\Types\DateTimeZoneId;
3435
use Laudis\Neo4j\Types\Duration;
3536
use Laudis\Neo4j\Types\LocalDateTime;
3637
use Laudis\Neo4j\Types\LocalTime;
@@ -51,7 +52,7 @@
5152
*
5253
* @see https://neo4j.com/docs/driver-manual/current/cypher-workflow/#driver-type-mapping
5354
*
54-
* @psalm-type OGMTypes = string|int|float|bool|null|Date|DateTime|Duration|LocalDateTime|LocalTime|Time|Node|Relationship|Path|Cartesian3DPoint|CartesianPoint|WGS84Point|WGS843DPoint|CypherList<mixed>|CypherMap<mixed>
55+
* @psalm-type OGMTypes = string|int|float|bool|null|Date|DateTime|Duration|LocalDateTime|LocalTime|Time|Node|Relationship|Path|Cartesian3DPoint|CartesianPoint|WGS84Point|WGS843DPoint|DateTimeZoneId|CypherList<mixed>|CypherMap<mixed>
5556
* @psalm-type OGMResults = CypherList<CypherMap<OGMTypes>>
5657
*
5758
* @psalm-import-type BoltMeta from FormatterInterface

tests/Integration/SummarizedResultFormatterTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,17 @@
1414
namespace Laudis\Neo4j\Tests\Integration;
1515

1616
use function bin2hex;
17+
18+
use DateTimeImmutable;
19+
1720
use function dump;
1821

1922
use Laudis\Neo4j\Contracts\TransactionInterface;
2023
use Laudis\Neo4j\Databags\SummarizedResult;
2124
use Laudis\Neo4j\Databags\SummaryCounters;
2225
use Laudis\Neo4j\Types\CypherList;
2326
use Laudis\Neo4j\Types\CypherMap;
27+
use Laudis\Neo4j\Types\DateTimeZoneId;
2428

2529
use function random_bytes;
2630
use function serialize;
@@ -96,4 +100,13 @@ public function testAvailableAfter(): void
96100

97101
self::assertGreaterThan(0, $results->getSummary()->getResultAvailableAfter());
98102
}
103+
104+
public function testDateTime(): void
105+
{
106+
$dt = new DateTimeImmutable();
107+
$ls = $this->getClient()->run('RETURN $x AS x', ['x' => $dt])->first()->get('x');
108+
109+
$this->assertInstanceOf(DateTimeZoneId::class, $ls);
110+
$this->assertEquals($dt, $ls->toDateTime());
111+
}
99112
}

0 commit comments

Comments
 (0)