Skip to content

Commit 6566b96

Browse files
committed
made a few changes for tests to run
1 parent 5e00118 commit 6566b96

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

src/ResponseParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ private function buildProfiledQueryPlan(?array $queryPlanData): ?ProfiledQueryPl
105105
return $this->ogm->map([
106106
'$type' => $value['$type'],
107107
'_value' => $value['_value']
108-
]); // ✅ Pass only expected keys
108+
]);
109109
}
110110
return $value;
111111
}, $queryPlanData['arguments'] ?? []);

tests/Integration/Neo4jQueryAPIIntegrationTest.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,17 +212,26 @@ public function testProfileCreateKnowsBidirectionalRelationships(): void
212212

213213
$result = $this->api->run($query);
214214
$this->assertNotNull($result->getProfiledQueryPlan(), "profiled query plan not found");
215+
215216
$body = file_get_contents(__DIR__ . '/../resources/responses/complex-query-profile.json');
216217

217218
if ($body === false) {
218219
throw new RuntimeException('Failed to read the file: ' . __DIR__ . '/../resources/responses/complex-query-profile.json');
219220
}
221+
220222
$mockSack = new MockHandler([
221223
new Response(200, [], $body),
222224
]);
223225

224226
$handler = HandlerStack::create($mockSack);
225227
$client = new Client(['handler' => $handler]);
228+
229+
$neo4jAddress = is_string(getenv('NEO4J_ADDRESS')) ? getenv('NEO4J_ADDRESS') : '';
230+
231+
if ($neo4jAddress === '') {
232+
throw new RuntimeException('NEO4J_ADDRESS is not set.');
233+
}
234+
226235
$auth = Authentication::fromEnvironment();
227236

228237
$api = new Neo4jQueryAPI(
@@ -231,12 +240,13 @@ public function testProfileCreateKnowsBidirectionalRelationships(): void
231240
new Neo4jRequestFactory(
232241
new Psr17Factory(),
233242
new Psr17Factory(),
234-
new Configuration('ABC'),
243+
new Configuration($neo4jAddress),
235244
$auth
236245
)
237246
);
238247

239-
$result = $api->run($query);
248+
249+
$result = $api->run($query);
240250

241251
$plan = $result->getProfiledQueryPlan();
242252
$this->assertNotNull($plan, "The result of the query should not be null.");

tests/Integration/Neo4jTransactionIntegrationTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,13 @@ class Neo4jTransactionIntegrationTest extends TestCase
2222
*/
2323
public function setUp(): void
2424
{
25-
putenv('NEO4J_ADDRESS=http://localhost:7474');
25+
parent::setUp();
2626

27+
$address = is_string(getenv('NEO4J_ADDRESS')) ? getenv('NEO4J_ADDRESS') : '';
28+
29+
if ($address === '') {
30+
throw new RuntimeException('NEO4J_ADDRESS is not set.');
31+
}
2732

2833
$this->api = $this->initializeApi();
2934
$this->clearDatabase();

0 commit comments

Comments
 (0)