Skip to content

Commit 67f1d6d

Browse files
Update ArcadeDB workflow and ClientTest to support dynamic credentials
1 parent 769c678 commit 67f1d6d

2 files changed

Lines changed: 16 additions & 10 deletions

File tree

.github/workflows/arcadedb.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ jobs:
1616
image: arcadedata/arcadedb
1717
ports:
1818
- 7687:7687
19+
- 2480:2480
20+
- 2424:2424
1921
env:
20-
JAVA_OPTS: -Darcadedb.server.plugins=Bolt:com.arcadedb.bolt.BoltProtocolPlugin
22+
JAVA_OPTS: '-Darcadedb.server.rootPassword=playwithdata -Darcadedb.server.plugins=Bolt:com.arcadedb.bolt.BoltProtocolPlugin'
2123

2224
steps:
2325
- name: Checkout
@@ -35,4 +37,7 @@ jobs:
3537
run: composer install --no-progress
3638

3739
- name: Test with phpunit
40+
env:
41+
NEO_USER: root
42+
NEO_PASS: playwithdata
3843
run: vendor/bin/phpunit --configuration phpunit.xml --testsuite "ArcadeDB"

tests/helpers/ClientTest.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,19 @@ private function getTestSuite(): string {
2929

3030
private function setUpClient($logHandler = null, $errorHandler = null): Client
3131
{
32-
$testsuite = $this->getTestSuite();
33-
3432
$conn = new \Bolt\connection\Socket('127.0.0.1', 7687);
3533
$bolt = new \Bolt\Bolt($conn);
36-
return new Client($bolt->build(), $testsuite === 'Neo4j' ? [
37-
'scheme' => 'basic',
38-
'principal' => $GLOBALS['NEO_USER'],
39-
'credentials' => $GLOBALS['NEO_PASS']
40-
] : [
41-
'scheme' => 'none'
42-
], $logHandler, $errorHandler);
4334

35+
$credentials = ['scheme' => 'none'];
36+
if (array_key_exists('NEO_USER', $GLOBALS) && array_key_exists('NEO_PASS', $GLOBALS)) {
37+
$credentials = [
38+
'scheme' => 'basic',
39+
'principal' => $GLOBALS['NEO_USER'],
40+
'credentials' => $GLOBALS['NEO_PASS']
41+
];
42+
}
43+
44+
return new Client($bolt->build(), $credentials, $logHandler, $errorHandler);
4445
}
4546

4647
public function testQuery(): void

0 commit comments

Comments
 (0)