Skip to content

Commit e9ebb1e

Browse files
committed
removed bug introduced via refactor
1 parent 7cd7539 commit e9ebb1e

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

src/Client.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace Laudis\Neo4j;
1515

16+
use InvalidArgumentException;
1617
use Laudis\Neo4j\Contracts\ClientInterface;
1718
use Laudis\Neo4j\Contracts\DriverInterface;
1819
use Laudis\Neo4j\Contracts\FormatterInterface;
@@ -26,6 +27,7 @@
2627
use Laudis\Neo4j\Enum\AccessMode;
2728
use Laudis\Neo4j\Types\CypherList;
2829
use Laudis\Neo4j\Types\CypherMap;
30+
use function array_key_exists;
2931

3032
/**
3133
* A collection of drivers with methods to run queries though them.
@@ -81,6 +83,10 @@ public function getDriver(?string $alias): DriverInterface
8183
{
8284
$alias = $this->decideAlias($alias);
8385

86+
if (!array_key_exists($alias, $this->drivers)) {
87+
throw new InvalidArgumentException(sprintf('The provided alias: "%s" was not found in the client', $alias));
88+
}
89+
8490
return $this->drivers[$alias];
8591
}
8692

src/Http/HttpDriver.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,23 +132,23 @@ public static function create($uri, ?DriverConfiguration $configuration = null,
132132
public function createSession(?SessionConfiguration $config = null): SessionInterface
133133
{
134134
$bindings = $this->config->getHttpPsrBindings();
135-
$factory = Resolvable::once($this->key, static function () use ($bindings) {
135+
$factory = Resolvable::once($this->key.':requestFactory', function () use ($bindings) {
136136
return new RequestFactory($bindings->getRequestFactory(), $this->auth, $this->uri, $this->config->getUserAgent());
137137
});
138138
$config ??= SessionConfiguration::default();
139139
$config = $config->merge(SessionConfiguration::fromUri($this->uri));
140-
$streamFactoryResolve = Resolvable::once($this->key, static fn () => $bindings->getStreamFactory());
141-
$clientResolve = Resolvable::once($this->key, static fn () => $bindings->getClient());
140+
$streamFactoryResolve = Resolvable::once($this->key.':streamFactory', static fn () => $bindings->getStreamFactory());
141+
$clientResolve = Resolvable::once($this->key.':client', static fn () => $bindings->getClient());
142142

143143
return new HttpSession(
144144
$streamFactoryResolve,
145145
new HttpConnectionPool($clientResolve, $factory, $streamFactoryResolve),
146146
$config,
147147
$this->formatter,
148148
$factory,
149-
Resolvable::once($this->key, function () use ($config) {
149+
Resolvable::once($this->key.':tsxUrl', function () use ($config, $factory) {
150150
$database = $config->getDatabase();
151-
$request = $this->config->getHttpPsrBindings()->getRequestFactory()->createRequest('GET', $this->uri);
151+
$request = $factory->resolve()->createRequest('GET', $this->uri);
152152
$client = $this->config->getHttpPsrBindings()->getClient();
153153

154154
$response = $client->sendRequest($request);

src/Types/Node.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,6 @@ public function toArray(): array
128128
public function getProperties(): CypherMap
129129
{
130130
/** @psalm-suppress InvalidReturnStatement false positive with type alias. */
131-
return new CypherMap($this);
131+
return $this->properties;
132132
}
133133
}

tests/Integration/ClientIntegrationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ public function testMultipleTransactions(string $alias): void
270270
public function testInvalidConnection(): void
271271
{
272272
$this->expectException(InvalidArgumentException::class);
273-
$this->expectExceptionMessage('The provided alias: "ghqkneq;tr" was not found in the connection pool');
273+
$this->expectExceptionMessage('The provided alias: "ghqkneq;tr" was not found in the client');
274274

275275
$this->client->run('RETURN 1 AS x', [], 'ghqkneq;tr');
276276
}

0 commit comments

Comments
 (0)