Skip to content

Commit 1ec5a1c

Browse files
committed
test: Add tests for new aliases
1 parent f889710 commit 1ec5a1c

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

src/DependencyInjection/Neo4jExtension.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,17 @@ public function load(array $configs, ContainerBuilder $container): ContainerBuil
6767
(new Definition(DriverInterface::class))
6868
->setFactory([new Reference('neo4j.client'), 'getDriver'])
6969
->setArgument(0, $driverConfig['alias'])
70-
);
70+
)
71+
->setPublic(true);
7172

7273
$container
7374
->setDefinition(
7475
'neo4j.session.'.$driverConfig['alias'],
7576
(new Definition(SessionInterface::class))
7677
->setFactory([new Reference('neo4j.driver.'.$driverConfig['alias']), 'createSession'])
7778
->setShared(false)
78-
);
79+
)
80+
->setPublic(true);
7981
}
8082

8183
$enabledProfiles = [];

tests/App/Controller/TestController.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
use Laudis\Neo4j\Contracts\ClientInterface;
66
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
77
use Symfony\Component\HttpFoundation\Response;
8-
use Symfony\Component\HttpKernel\Profiler\Profiler;
9-
use Symfony\Component\Stopwatch\Stopwatch;
108

119
class TestController extends AbstractController
1210
{
@@ -15,7 +13,7 @@ public function __construct(
1513
) {
1614
}
1715

18-
public function __invoke(Profiler $profiler, Stopwatch $stopwatch): Response
16+
public function __invoke(): Response
1917
{
2018
// Successful statement
2119
$this->client->run('MATCH (n {foo: $bar}) RETURN n', ['bar' => 'baz']);

tests/Functional/IntegrationTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,18 @@ public function testDefaultTransactionConfig(): void
196196
$this->assertSame($transactionConfig->getTimeout(), 40.0);
197197
}
198198

199+
public function testDriverAndSessionTags(): void
200+
{
201+
static::bootKernel();
202+
$container = static::getContainer();
203+
204+
$this->assertTrue($container->has('neo4j.driver.neo4j-simple'));
205+
$this->assertTrue($container->has('neo4j.driver.neo4j-test'));
206+
207+
$this->assertTrue($container->has('neo4j.session.neo4j-simple'));
208+
$this->assertTrue($container->has('neo4j.session.neo4j-test'));
209+
}
210+
199211
public function testPriority(): void
200212
{
201213
static::bootKernel();

0 commit comments

Comments
 (0)