@@ -47,16 +47,121 @@ public function testCounters(): void
4747
4848 public function testProfileExistence (): void
4949 {
50- $ query = "PROFILE MATCH (n:Person {name: 'Alice'} ) RETURN n.name " ;
50+ $ query = "PROFILE MATCH (n:Person) RETURN n.name " ;
5151 $ result = $ this ->api ->run ($ query );
52- $ this ->assertNotNull ($ result ->getProfiledQueryPlan (),"profiled query plan not found " );
52+ $ this ->assertNotNull ($ result ->getProfiledQueryPlan (), "profiled query plan not found " );
5353 }
54- public function testQueryArgumentsExistence (): void
54+
55+ public function testProfileCreateQueryExistence (): void
56+ {
57+ // Define the CREATE query
58+ $ query = "
59+ PROFILE UNWIND range(1, 100) AS i
60+ CREATE (:Person {
61+ name: 'Person' + toString(i),
62+ id: i,
63+ job: CASE
64+ WHEN i % 2 = 0 THEN 'Engineer'
65+ ELSE 'Artist'
66+ END,
67+ age: 1 + i - 1
68+ });
69+ " ;
70+
71+ $ result = $ this ->api ->run ($ query );
72+
73+ $ this ->assertNotNull ($ result ->getProfiledQueryPlan (), "profiled query plan not found " );
74+ }
75+
76+ public function testProfileCreateMovieQueryExistence (): void
77+ {
78+ $ query = "
79+ PROFILE UNWIND range(1, 50) AS i
80+ CREATE (:Movie {
81+ year: 2000 + i,
82+ genre: CASE
83+ WHEN i % 2 = 0 THEN 'Action'
84+ ELSE 'Comedy'
85+ END,
86+ title: 'Movie' + toString(i)
87+ });
88+ " ;
89+
90+ $ result = $ this ->api ->run ($ query );
91+
92+ $ this ->assertNotNull ($ result ->getProfiledQueryPlan (), "profiled query plan not found " );
93+ }
94+
95+ public function testProfileCreateFriendsQueryExistence (): void
96+ {
97+ $ query = "
98+ PROFILE UNWIND range(1, 100) AS i
99+ UNWIND range(1, 100) AS j
100+ MATCH (a:Person {id: i}), (b:Person {id: j})
101+ WHERE a.id <> b.id AND rand() < 0.1
102+ CREATE (a)-[:FRIENDS]->(b);
103+ " ;
104+
105+ $ result = $ this ->api ->run ($ query );
106+
107+
108+ $ this ->assertNotNull ($ result ->getProfiledQueryPlan (), "profiled query plan not found " );
109+ }
110+
111+ public function testProfileCreateWatchedRelationshipExistence (): void
112+ {
113+
114+ $ query = "
115+ PROFILE UNWIND range(1, 50) AS i
116+ MATCH (p:Person), (m:Movie {year: 2000 + i})
117+ CREATE (p)-[:WATCHED]->(m);
118+ " ;
119+
120+ $ result = $ this ->api ->run ($ query );
121+
122+ $ this ->assertNotNull ($ result ->getProfiledQueryPlan (), "profiled query plan not found " );
123+ }
124+
125+ public function testProfileCreateWatchedWithFilters (): void
55126 {
56- $ query = "PROFILE MATCH (n:Person {name: 'Alice'}) RETURN n.name " ;
127+ $ query = "
128+ PROFILE UNWIND range(1, 50) AS i
129+ MATCH (p:Person), (m:Movie {year: 2000 + i})
130+ WHERE p.age > 25 AND m.genre = 'Action'
131+ CREATE (p)-[:WATCHED]->(m);
132+ " ;
133+
57134 $ result = $ this ->api ->run ($ query );
58- $ this ->assertNotNull ($ result ->getQueryArguments ()," QueryArguments should not be null " );
135+ $ this ->assertNotNull ($ result ->getProfiledQueryPlan (), " profiled query plan not found " );
59136 }
137+
138+ public function testProfileCreateKnowsBidirectionalRelationships (): void
139+ {
140+ $ query = "
141+ PROFILE UNWIND range(1, 100) AS i
142+ UNWIND range(1, 100) AS j
143+ MATCH (a:Person {id: i}), (b:Person {id: j})
144+ WHERE a.id < b.id AND rand() < 0.1
145+ CREATE (a)-[:KNOWS]->(b), (b)-[:KNOWS]->(a);
146+ " ;
147+
148+ $ result = $ this ->api ->run ($ query );
149+ $ this ->assertNotNull ($ result ->getProfiledQueryPlan (), "profiled query plan not found " );
150+ }
151+
152+ public function testProfileCreateActedInRelationships (): void
153+ {
154+ $ query = "
155+ PROFILE UNWIND range(1, 50) AS i
156+ MATCH (p:Person {id: i}), (m:Movie {year: 2000 + i})
157+ WHERE p.job = 'Artist'
158+ CREATE (p)-[:ACTED_IN]->(m);
159+ " ;
160+
161+ $ result = $ this ->api ->run ($ query );
162+ $ this ->assertNotNull ($ result ->getProfiledQueryPlan (), "profiled query plan not found " );
163+ }
164+
60165 public function testChildQueryPlanExistence (): void
61166 {
62167 $ result = $ this ->api ->run ("PROFILE MATCH (n:Person {name: 'Alice'}) RETURN n.name " );
@@ -99,8 +204,6 @@ public function testTransactionCommit(): void
99204 }
100205
101206
102-
103-
104207 /**
105208 * @throws GuzzleException
106209 */
@@ -123,7 +226,7 @@ private function populateTestData(): void
123226 /**
124227 * @throws GuzzleException
125228 */
126- // #[DataProvider(methodName: 'queryProvider')]
229+ #[DataProvider(methodName: 'queryProvider ' )]
127230 public function testRunSuccessWithParameters (
128231 string $ query ,
129232 array $ parameters ,
@@ -148,7 +251,6 @@ public function testInvalidQueryException(): void
148251 }
149252
150253
151-
152254 public function testCreateDuplicateConstraintException (): void
153255 {
154256 try {
0 commit comments