Skip to content

Commit 0b95094

Browse files
exaby73transistive
authored andcommitted
fix: Existing integration tests
1 parent a26c555 commit 0b95094

File tree

3 files changed

+69
-52
lines changed

3 files changed

+69
-52
lines changed

docker-compose.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
version: '3.7'
21
networks:
32
neo4j-symfony:
43

54
services:
65
app:
7-
user: ${UID-1000}:${GID-1000}
6+
user: root:${UID-1000}:${GID-1000}
87
build:
98
context: .
109
ports:
@@ -24,7 +23,7 @@ services:
2423
neo4j:
2524
environment:
2625
- NEO4J_AUTH=neo4j/testtest
27-
image: neo4j:5
26+
image: neo4j:5.22
2827
ports:
2928
- ${DOCKER_HOST_NEO4J_HTTP_PORT:-7474}:7474
3029
- ${DOCKER_HOST_NEO4J_BOLT_PORT:-7687}:7687

tests/App/config/default.yml

Lines changed: 41 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,44 @@
11
framework:
2-
secret: test
3-
test: true
2+
secret: test
3+
test: true
44

55
neo4j:
6-
default_driver: neo4j-test
7-
default_driver_config:
8-
acquire_connection_timeout: 10
9-
user_agent: 'Neo4j Symfony Bundle/testing'
10-
pool_size: 256
11-
ssl:
12-
mode: enable
13-
verify_peer: false
14-
default_session_config:
15-
fetch_size: 999
16-
access_mode: read
17-
database: symfony
18-
default_transaction_config:
19-
timeout: 40
20-
21-
drivers:
22-
- alias: neo4j_undefined_configs
23-
dsn: bolt://localhost
24-
25-
- alias: neo4j-enforced-defaults
26-
dsn: bolt://localhost
27-
priority: null
28-
29-
- alias: neo4j-partly-enforced-defaults
30-
dsn: neo4j://neo4j:secret@localhost:7688
31-
32-
- alias: neo4j-simple
33-
dsn: 'bolt://test:test@localhost'
34-
35-
- alias: neo4j-fallback-mechanism
36-
priority: 100
37-
dsn: bolt://localhost
38-
39-
- alias: neo4j-fallback-mechanism
40-
priority: 1000
41-
dsn: bolt://localhost
42-
43-
- alias: neo4j-test
44-
dsn: neo4j://neo4j:testtest@neo4j
45-
46-
6+
default_driver: neo4j-test
7+
default_driver_config:
8+
acquire_connection_timeout: 10
9+
user_agent: "Neo4j Symfony Bundle/testing"
10+
pool_size: 256
11+
ssl:
12+
mode: disable
13+
verify_peer: false
14+
default_session_config:
15+
fetch_size: 999
16+
access_mode: read
17+
database: neo4j
18+
default_transaction_config:
19+
timeout: 40
20+
21+
drivers:
22+
- alias: neo4j_undefined_configs
23+
dsn: bolt://localhost
24+
25+
- alias: neo4j-enforced-defaults
26+
dsn: bolt://localhost
27+
priority: null
28+
29+
- alias: neo4j-partly-enforced-defaults
30+
dsn: neo4j://neo4j:secret@localhost:7688
31+
32+
- alias: neo4j-simple
33+
dsn: "bolt://test:test@localhost"
34+
35+
- alias: neo4j-fallback-mechanism
36+
priority: 100
37+
dsn: bolt://localhost
38+
39+
- alias: neo4j-fallback-mechanism
40+
priority: 1000
41+
dsn: bolt://localhost
42+
43+
- alias: neo4j-test
44+
dsn: neo4j://neo4j:testtest@neo4j

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

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66

77
use Laudis\Neo4j\Contracts\ClientInterface;
88
use Laudis\Neo4j\Contracts\DriverInterface;
9+
use Laudis\Neo4j\Neo4j\Neo4jDriver;
910
use Neo4j\Neo4jBundle\Tests\App\TestKernel;
11+
use Psr\Http\Message\UriInterface;
1012
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
1113

12-
class Integration extends KernelTestCase
14+
class IntegrationTest extends KernelTestCase
1315
{
1416
protected static function getKernelClass(): string
1517
{
@@ -57,10 +59,22 @@ public function testDefaultDsn(): void
5759
static::bootKernel();
5860
$container = static::getContainer();
5961

62+
/**
63+
* @var ClientInterface $client
64+
*/
6065
$client = $container->get('neo4j.client');
61-
$this->expectException(\RuntimeException::class);
62-
$this->expectExceptionMessage("Cannot connect to any server on alias: neo4j_undefined_configs with Uris: ('bolt://localhost')");
63-
$client->getDriver('default');
66+
/**
67+
* @var Neo4jDriver $driver
68+
*/
69+
$driver = $client->getDriver('default');
70+
$reflection = new \ReflectionClass($driver);
71+
$property = $reflection->getProperty('parsedUrl');
72+
/**
73+
* @var UriInterface $uri
74+
*/
75+
$uri = $property->getValue($driver);
76+
77+
$this->assertSame($uri->getScheme(), 'neo4j');
6478
}
6579

6680
public function testDsn(): void
@@ -69,8 +83,14 @@ public function testDsn(): void
6983
$container = static::getContainer();
7084

7185
$this->expectException(\RuntimeException::class);
72-
$this->expectExceptionMessage("Cannot connect to any server on alias: neo4j_undefined_configs with Uris: ('bolt://localhost')");
86+
$this->expectExceptionMessage(
87+
"Cannot connect to any server on alias: neo4j_undefined_configs with Uris: ('bolt://localhost')"
88+
);
7389

74-
$container->get('neo4j.driver');
90+
/**
91+
* @var ClientInterface $client
92+
*/
93+
$client = $container->get('neo4j.client');
94+
$client->getDriver('neo4j_undefined_configs');
7595
}
7696
}

0 commit comments

Comments
 (0)