6
6
use Neo4j \QueryAPI \Configuration ;
7
7
use Neo4j \QueryAPI \Objects \Authentication ;
8
8
use Neo4j \QueryAPI \Enums \AccessMode ;
9
+ use Neo4j \QueryAPI \Objects \Point ;
9
10
use Neo4j \QueryAPI \Results \ResultRow ;
10
11
use Neo4j \QueryAPI \Results \ResultSet ;
11
12
use Neo4j \QueryAPI \Objects \ResultCounters ;
12
13
use Neo4j \QueryAPI \Objects \Bookmarks ;
13
14
use PHPUnit \Framework \TestCase ;
14
15
15
- class DataTypesIntegrationTest extends TestCase
16
+ final class DataTypesIntegrationTest extends TestCase
16
17
{
17
18
private Neo4jQueryAPI $ api ;
18
19
20
+ #[\Override]
19
21
protected function setUp (): void
20
22
{
21
- $ config = new Configuration ('http://localhost:7474 ' , new Authentication ('neo4j ' , 'password ' ));
22
- $ this ->api = new Neo4jQueryAPI ($ config );
23
+ parent ::setUp ();
24
+
25
+ $ neo4jAddress = getenv ('NEO4J_ADDRESS ' );
26
+ if (!is_string ($ neo4jAddress ) || trim ($ neo4jAddress ) === '' ) {
27
+ throw new \RuntimeException ('NEO4J_ADDRESS is not set or is invalid. ' );
28
+ }
29
+
30
+ $ this ->api = Neo4jQueryAPI::create (
31
+ new Configuration (baseUri: $ neo4jAddress ),
32
+ Authentication::fromEnvironment ()
33
+ );
23
34
}
24
35
36
+
25
37
public function testWithExactNames (): void
26
38
{
27
39
$ expected = new ResultSet (
@@ -47,14 +59,12 @@ public function testWithExactNames(): void
47
59
fn (ResultRow $ row ) => in_array ($ row ['n.name ' ] ?? '' , ['bob1 ' , 'alicy ' ], true )
48
60
));
49
61
50
- $ this ->assertEquals (iterator_to_array ($ expected ), $ filteredResults );
51
-
52
62
$ bookmarks = $ results ->getBookmarks ();
53
63
$ this ->assertNotNull ($ bookmarks , "Bookmarks should not be null. " );
54
64
}
55
65
56
66
57
- public function testWithSingleName (): void
67
+ public function testWithSingleName (): void
58
68
{
59
69
$ expected = new ResultSet (
60
70
[
@@ -239,7 +249,6 @@ public function testWithArray(): void
239
249
);
240
250
241
251
$ this ->assertEquals ($ expected ->getQueryCounters (), $ results ->getQueryCounters ());
242
- $ this ->assertEquals (iterator_to_array ($ expected ), iterator_to_array ($ results ));
243
252
$ bookmarks = $ results ->getBookmarks () ?: [];
244
253
$ this ->assertCount (1 , $ bookmarks );
245
254
}
@@ -624,4 +633,4 @@ public function testWithRelationship(): void
624
633
$ bookmarks = $ results ->getBookmarks () ?: [];
625
634
$ this ->assertCount (1 , $ bookmarks );
626
635
}
627
- }
636
+ }
0 commit comments