File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -33,4 +33,40 @@ public function testReadmeExample(): void
33
33
34
34
$ this ->assertStringMatchesFormat ("MATCH (:Person {name: 'Tom Hanks'})-[:ACTED_IN]->()<-[:ACTED_IN]-(%s) RETURN %s.name " , $ statement );
35
35
}
36
+
37
+ public function testCallSubqueryClauseExample1 (): void
38
+ {
39
+ $ query = Query::new ()
40
+ ->call (static function (Query $ query ): void
41
+ {
42
+ $ query ->create (Query::node ("Person " ));
43
+ })
44
+ ->build ();
45
+
46
+ $ this ->assertSame ("CALL { CREATE (:Person) } " , $ query );
47
+ }
48
+
49
+ public function testCallSubqueryClauseExample2 (): void
50
+ {
51
+ $ subQuery = Query::new ()->create (Query::node ("Person " ));
52
+ $ query = Query::new ()
53
+ ->call ($ subQuery )
54
+ ->build ();
55
+
56
+ $ this ->assertSame ("CALL { CREATE (:Person) } " , $ query );
57
+ }
58
+
59
+ public function testCallSubqueryClauseExample3 (): void
60
+ {
61
+ $ person = Query::variable ();
62
+ $ query = Query::new ()
63
+ ->match (Query::node ('Person ' )->withVariable ($ person ))
64
+ ->call (static function (Query $ query ) use ($ person ): void
65
+ {
66
+ $ query ->remove ($ person ->labeled ('Person ' ));
67
+ }, [$ person ])
68
+ ->build ();
69
+
70
+ $ this ->assertStringMatchesFormat ("MATCH (%s:Person) CALL { WITH %s REMOVE %s:Person } " , $ query );
71
+ }
36
72
}
You can’t perform that action at this time.
0 commit comments