Skip to content

Commit 7c06cee

Browse files
committed
fixed tests
1 parent b94e710 commit 7c06cee

File tree

6 files changed

+41
-13
lines changed

6 files changed

+41
-13
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ RUN apt-get update \
77
wget \
88
&& docker-php-ext-install -j$(nproc) bcmath sockets \
99
&& pecl install xdebug \
10-
&& docker-php-ext-enable xdebug && \
11-
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
10+
&& docker-php-ext-enable xdebug \
11+
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
1212

1313
WORKDIR /opt/project
1414

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Applications that use Symfony Flex
2020
Open a command console, enter your project directory and execute:
2121

2222
```console
23-
$ composer require neo4j/neo4j-bundle
23+
$ composer require neo4j
2424
```
2525

2626
Applications that don't use Symfony Flex

src/ClientFactory.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public function __construct(
4444
private array|null $sessionConfiguration,
4545
private array|null $transactionConfiguration,
4646
private array $connections,
47+
private string|null $defaultDriver,
4748
private ClientInterface|null $client,
4849
private StreamFactoryInterface|null $streamFactory,
4950
private RequestFactoryInterface|null $requestFactory,
@@ -76,6 +77,10 @@ public function create(): SymfonyClient
7677
);
7778
}
7879

80+
if ($this->defaultDriver) {
81+
$builder = $builder->withDefaultDriver($this->defaultDriver);
82+
}
83+
7984
return new SymfonyClient($builder->build(), $this->eventHandler);
8085
}
8186

src/DependencyInjection/Neo4jExtension.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@ public function load(array $configs, ContainerBuilder $container): ContainerBuil
3535
->setArgument(2, $mergedConfig['default_session_config'] ?? null)
3636
->setArgument(3, $mergedConfig['default_transaction_config'] ?? null)
3737
->setArgument(4, $mergedConfig['drivers'] ?? [])
38-
->setArgument(5, new Reference(ClientInterface::class, ContainerInterface::NULL_ON_INVALID_REFERENCE))
39-
->setArgument(6, new Reference(StreamFactoryInterface::class, ContainerInterface::NULL_ON_INVALID_REFERENCE))
40-
->setArgument(7, new Reference(RequestFactoryInterface::class, ContainerInterface::NULL_ON_INVALID_REFERENCE))
38+
->setArgument(5, $mergedConfig['default_driver'] ?? null)
39+
->setArgument(6, new Reference(ClientInterface::class, ContainerInterface::NULL_ON_INVALID_REFERENCE))
40+
->setArgument(7, new Reference(StreamFactoryInterface::class, ContainerInterface::NULL_ON_INVALID_REFERENCE))
41+
->setArgument(8, new Reference(RequestFactoryInterface::class, ContainerInterface::NULL_ON_INVALID_REFERENCE))
4142
->setAbstract(false)
4243
;
4344

tests/App/config/default.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,7 @@ neo4j:
4040
priority: 1000
4141
dsn: bolt://localhost
4242

43+
- alias: neo4j-test
44+
dsn: neo4j://neo4j:testtest@neo4j
45+
4346

tests/Functional/BundleInitializationTest.php renamed to tests/Functional/Integration.php

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,51 @@
55
namespace Neo4j\Neo4jBundle\Tests\Functional;
66

77
use Laudis\Neo4j\Contracts\ClientInterface;
8+
use Laudis\Neo4j\Contracts\DriverInterface;
89
use Neo4j\Neo4jBundle\Tests\App\TestKernel;
910
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
1011

11-
/**
12-
* @author Tobias Nyholm <[email protected]>
13-
*/
14-
class BundleInitializationTest extends KernelTestCase
12+
class Integration extends KernelTestCase
1513
{
1614
protected static function getKernelClass(): string
1715
{
1816
return TestKernel::class;
1917
}
2018

21-
public function testRegisterBundle(): void
19+
public static function setUpBeforeClass(): void
20+
{
21+
parent::setUpBeforeClass();
22+
self::bootKernel();
23+
}
24+
25+
public function testClient(): void
2226
{
2327
static::bootKernel();
2428
$container = static::getContainer();
2529

2630
$this->assertTrue($container->has('neo4j.client'));
2731
$client = $container->get('neo4j.client');
28-
self::assertInstanceOf(ClientInterface::class, $client);
2932
$this->assertInstanceOf(ClientInterface::class, $client);
3033

3134
$this->assertTrue($container->has(ClientInterface::class));
32-
self::assertInstanceOf(ClientInterface::class, $client);
3335
$this->assertInstanceOf(ClientInterface::class, $client);
36+
37+
$this->assertSame($client, $container->get('neo4j.client'));
38+
}
39+
40+
public function testDriver(): void
41+
{
42+
static::bootKernel();
43+
$container = static::getContainer();
44+
45+
$this->assertTrue($container->has('neo4j.driver'));
46+
$driver = $container->get('neo4j.driver');
47+
$this->assertInstanceOf(DriverInterface::class, $driver);
48+
49+
$this->assertTrue($container->has(DriverInterface::class));
50+
$this->assertInstanceOf(DriverInterface::class, $driver);
51+
52+
$this->assertSame($driver, $container->get('neo4j.driver'));
3453
}
3554

3655
public function testDefaultDsn(): void

0 commit comments

Comments
 (0)