diff --git a/docker-compose.yml b/docker-compose.yml
index 096e8e73..6ec5df96 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -26,7 +26,7 @@ x-definitions:
build:
context: .
dockerfile: Dockerfile
- image: neo4j-php-client:latest
+# image: neo4j-php-client:latest
volumes:
- .:/opt/project
x-common-cluster:
diff --git a/psalm-baseline.xml b/psalm-baseline.xml
index afefc4e0..d229bf89 100644
--- a/psalm-baseline.xml
+++ b/psalm-baseline.xml
@@ -1,171 +1,2 @@
-
-
-
- $pass
-
-
-
-
- enableSsl($uri->getHost(), $sslConfig, $config)]]]>
- [$sslConfig, []]
-
-
-
-
-
-
-
- semaphore]]>
- semaphore]]>
- sem_get(hexdec($key), $max)
-
-
-
-
- DatabaseInfo
-
-
-
-
- Plan
-
-
-
-
- ProfiledPlan
-
-
-
-
- ResultSummary
-
-
-
-
- ServerInfo
-
-
-
-
- Statement
-
-
-
-
- SummaryCounters
-
-
-
-
- $meta
-
-
-
-
- $coordinates
-
-
-
-
- $value
- $value
-
-
- translateCypherList($value, $meta)]]>
- [new CypherList($tbr), $meta]
-
-
- array{0: OGMTypes, 1: HttpMetaInfo}
-
-
- $milliseconds
- $milliseconds
- $secondsFraction
- $time
- $time
- $timezone
- $tzMinutes
-
-
-
-
- $response
-
-
-
-
-
-
-
- array{x: float, y: float, z: float, srid: int, crs: Crs}
-
-
-
-
- keyCache]]>
- keyCache]]>
-
-
-
-
- AbstractPoint
-
-
-
-
- ]]>
-
-
-
-
- ]]>
-
-
-
-
- $item
-
-
- ++$counter;
- self::assertEquals(0, $counter);
-
-
-
- $counter
- $key
-
-
-
-
- IteratorAggregate
-
-
- $item
-
-
- ++$counter;
- self::assertEquals(0, $counter);
- 'x'][$key], $item);]]>
-
-
- $counter
- $key
-
-
-
-
- resolver->getAddresses('8.8.8.8')]]>
- resolver->getAddresses('bogus')]]>
- resolver->getAddresses('test.ghlen.com')]]>
-
-
- $records
-
-
-
-
- Iterator
-
-
-
+
diff --git a/src/Client.php b/src/Client.php
index 5a3e4b4e..05323aa8 100644
--- a/src/Client.php
+++ b/src/Client.php
@@ -55,6 +55,21 @@ public function __construct(
private TransactionConfiguration $defaultTransactionConfiguration
) {}
+ public function getDriverSetups(): DriverSetupManager
+ {
+ return $this->driverSetups;
+ }
+
+ public function getDefaultSessionConfiguration(): SessionConfiguration
+ {
+ return $this->defaultSessionConfiguration;
+ }
+
+ public function getDefaultTransactionConfiguration(): TransactionConfiguration
+ {
+ return $this->defaultTransactionConfiguration;
+ }
+
public function run(string $statement, iterable $parameters = [], ?string $alias = null)
{
return $this->runStatement(Statement::create($statement, $parameters), $alias);
diff --git a/src/ClientBuilder.php b/src/ClientBuilder.php
index 83d3f35e..4b31986c 100644
--- a/src/ClientBuilder.php
+++ b/src/ClientBuilder.php
@@ -163,7 +163,8 @@ public function build(): ClientInterface
public function withDefaultDriverConfiguration(DriverConfiguration $config): self
{
$tbr = clone $this;
- $tbr->defaultDriverConfig = $config;
+
+ $tbr->driverSetups = $tbr->driverSetups->withDriverConfiguration($config);
return $tbr;
}
diff --git a/src/Common/DriverSetupManager.php b/src/Common/DriverSetupManager.php
index f954df67..838a1f7f 100644
--- a/src/Common/DriverSetupManager.php
+++ b/src/Common/DriverSetupManager.php
@@ -57,6 +57,20 @@ public function __construct(
private DriverConfiguration $configuration
) {}
+ public function getDriverConfiguration(): DriverConfiguration
+ {
+ return $this->configuration;
+ }
+
+ public function withDriverConfiguration(DriverConfiguration $config): self
+ {
+ $tbr = clone $this;
+
+ $tbr->configuration = $config;
+
+ return $tbr;
+ }
+
/**
* @psalm-mutation-free
*/
diff --git a/tests/Integration/ClientBuilderTest.php b/tests/Integration/ClientBuilderTest.php
new file mode 100644
index 00000000..2b8c4991
--- /dev/null
+++ b/tests/Integration/ClientBuilderTest.php
@@ -0,0 +1,48 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Integration;
+
+use Laudis\Neo4j\Client;
+use Laudis\Neo4j\ClientBuilder;
+use Laudis\Neo4j\Databags\DriverConfiguration;
+use Laudis\Neo4j\Databags\SessionConfiguration;
+use Laudis\Neo4j\Databags\SslConfiguration;
+use Laudis\Neo4j\Databags\TransactionConfiguration;
+use Laudis\Neo4j\Enum\SslMode;
+use PHPUnit\Framework\TestCase;
+
+class ClientBuilderTest extends TestCase
+{
+ public function testGetClient(): void
+ {
+ $sslConfig = SslConfiguration::default()->withVerifyPeer(false)->withMode(SslMode::FROM_URL());
+ $driverconfig = DriverConfiguration::default()
+ ->withSslConfiguration($sslConfig)
+ ->withMaxPoolSize(4096)
+ ->withAcquireConnectionTimeout(2.5);
+ $sessionConfig = SessionConfiguration::default()->withDatabase('neo4j');
+ $transactionConfig = TransactionConfiguration::default()->withTimeout(120.0);
+ $client = ClientBuilder::create()
+ ->withDefaultDriverConfiguration($driverconfig)
+ ->withDefaultSessionConfiguration($sessionConfig)
+ ->withDefaultTransactionConfiguration($transactionConfig)
+ ->build();
+
+ self::assertInstanceOf(Client::class, $client);
+ self::assertEquals($driverconfig, $client->getDriverSetups()->getDriverConfiguration());
+ self::assertEquals($sslConfig, $client->getDriverSetups()->getDriverConfiguration()->getSslConfiguration());
+ self::assertEquals($sessionConfig, $client->getDefaultSessionConfiguration());
+ self::assertEquals($transactionConfig, $client->getDefaultTransactionConfiguration());
+ }
+}