|
13 | 13 |
|
14 | 14 | namespace Laudis\Neo4j\Tests\Integration;
|
15 | 15 |
|
16 |
| -use Laudis\Neo4j\Contracts\ClientInterface; |
17 | 16 | use Laudis\Neo4j\Contracts\FormatterInterface;
|
18 | 17 | use Laudis\Neo4j\Formatter\SummarizedResultFormatter;
|
19 | 18 | use Laudis\Neo4j\Tests\Fixtures\MoviesFixture;
|
|
22 | 21 | /**
|
23 | 22 | * @psalm-suppress all
|
24 | 23 | */
|
25 |
| -final class DriverParityTest extends SelectableDriverIntegrationTestCase |
| 24 | +final class DriverParityTest extends EnvironmentAwareIntegrationTest |
26 | 25 | {
|
27 |
| - private const TESTABLE_SCHEMES = ['bolt', 'http']; |
28 |
| - |
29 |
| - protected function setUp(): void |
| 26 | + public static function setUpBeforeClass(): void |
30 | 27 | {
|
31 |
| - parent::setUp(); |
32 |
| - $client = $this->getClient(); |
33 |
| - |
34 |
| - $client->run('MATCH (n) DETACH DELETE n'); |
35 |
| - $client->run(MoviesFixture::CQL); |
| 28 | + parent::setUpBeforeClass(); |
| 29 | + foreach (self::connectionAliases() as $alias) { |
| 30 | + $session = self::$client->getDriver($alias[0])->createSession(); |
| 31 | + $session->run('MATCH (x) DETACH DELETE x', []); |
| 32 | + $session->run(MoviesFixture::CQL, []); |
| 33 | + } |
36 | 34 | }
|
37 | 35 |
|
38 | 36 | protected static function formatter(): FormatterInterface
|
39 | 37 | {
|
40 | 38 | return SummarizedResultFormatter::create();
|
41 | 39 | }
|
42 | 40 |
|
43 |
| - public function testCanHandleMapLiterals(): void |
| 41 | + /** |
| 42 | + * @dataProvider connectionAliases |
| 43 | + */ |
| 44 | + public function testCanHandleMapLiterals(string $alias): void |
44 | 45 | {
|
45 |
| - $this->runParityTest(function (ClientInterface $client) { |
46 |
| - $results = $client->run('MATCH (n:Person)-[r:ACTED_IN]->(m) RETURN n, {movie: m, roles: r.roles} AS actInfo LIMIT 5'); |
| 46 | + $results = $this->getClient()->run('MATCH (n:Person)-[r:ACTED_IN]->(m) RETURN n, {movie: m, roles: r.roles} AS actInfo LIMIT 5', [], $alias); |
47 | 47 |
|
48 |
| - foreach ($results as $result) { |
49 |
| - $actorInfo = $result->get('actInfo'); |
| 48 | + foreach ($results as $result) { |
| 49 | + $actorInfo = $result->get('actInfo'); |
50 | 50 |
|
51 |
| - $this->assertInstanceOf(CypherMap::class, $actorInfo); |
52 |
| - $this->assertTrue($actorInfo->hasKey('roles')); |
53 |
| - $this->assertTrue($actorInfo->hasKey('movie')); |
54 |
| - } |
55 |
| - }); |
56 |
| - } |
57 |
| - |
58 |
| - private function runParityTest(callable $test): void |
59 |
| - { |
60 |
| - foreach (self::TESTABLE_SCHEMES as $scheme) { |
61 |
| - $client = $this->getClientForScheme($scheme); |
62 |
| - echo 'Testing '.$scheme.' for '.$this->getName().PHP_EOL; |
63 |
| - $test($client); |
64 |
| - echo $scheme.' passed'.PHP_EOL; |
| 51 | + $this->assertInstanceOf(CypherMap::class, $actorInfo); |
| 52 | + $this->assertTrue($actorInfo->hasKey('roles')); |
| 53 | + $this->assertTrue($actorInfo->hasKey('movie')); |
65 | 54 | }
|
66 | 55 | }
|
67 | 56 | }
|
0 commit comments