From 1ec5a1c2317a2e5bab2f36a8d67f87fe17c42f92 Mon Sep 17 00:00:00 2001 From: exaby73 Date: Wed, 6 Nov 2024 14:31:58 +0530 Subject: [PATCH] test: Add tests for new aliases --- src/DependencyInjection/Neo4jExtension.php | 6 ++++-- tests/App/Controller/TestController.php | 4 +--- tests/Functional/IntegrationTest.php | 12 ++++++++++++ 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/DependencyInjection/Neo4jExtension.php b/src/DependencyInjection/Neo4jExtension.php index d60343b..339bf49 100644 --- a/src/DependencyInjection/Neo4jExtension.php +++ b/src/DependencyInjection/Neo4jExtension.php @@ -67,7 +67,8 @@ public function load(array $configs, ContainerBuilder $container): ContainerBuil (new Definition(DriverInterface::class)) ->setFactory([new Reference('neo4j.client'), 'getDriver']) ->setArgument(0, $driverConfig['alias']) - ); + ) + ->setPublic(true); $container ->setDefinition( @@ -75,7 +76,8 @@ public function load(array $configs, ContainerBuilder $container): ContainerBuil (new Definition(SessionInterface::class)) ->setFactory([new Reference('neo4j.driver.'.$driverConfig['alias']), 'createSession']) ->setShared(false) - ); + ) + ->setPublic(true); } $enabledProfiles = []; diff --git a/tests/App/Controller/TestController.php b/tests/App/Controller/TestController.php index 98969b0..63397e5 100644 --- a/tests/App/Controller/TestController.php +++ b/tests/App/Controller/TestController.php @@ -5,8 +5,6 @@ use Laudis\Neo4j\Contracts\ClientInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Profiler\Profiler; -use Symfony\Component\Stopwatch\Stopwatch; class TestController extends AbstractController { @@ -15,7 +13,7 @@ public function __construct( ) { } - public function __invoke(Profiler $profiler, Stopwatch $stopwatch): Response + public function __invoke(): Response { // Successful statement $this->client->run('MATCH (n {foo: $bar}) RETURN n', ['bar' => 'baz']); diff --git a/tests/Functional/IntegrationTest.php b/tests/Functional/IntegrationTest.php index ece543a..8020681 100644 --- a/tests/Functional/IntegrationTest.php +++ b/tests/Functional/IntegrationTest.php @@ -196,6 +196,18 @@ public function testDefaultTransactionConfig(): void $this->assertSame($transactionConfig->getTimeout(), 40.0); } + public function testDriverAndSessionTags(): void + { + static::bootKernel(); + $container = static::getContainer(); + + $this->assertTrue($container->has('neo4j.driver.neo4j-simple')); + $this->assertTrue($container->has('neo4j.driver.neo4j-test')); + + $this->assertTrue($container->has('neo4j.session.neo4j-simple')); + $this->assertTrue($container->has('neo4j.session.neo4j-test')); + } + public function testPriority(): void { static::bootKernel();