Skip to content

Commit 909cd4e

Browse files
committed
test performance improvements
1 parent e0825c4 commit 909cd4e

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

tests/Integration/EnvironmentAwareIntegrationTest.php

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,23 @@ abstract class EnvironmentAwareIntegrationTest extends TestCase
3030
/** @var ClientInterface<T> */
3131
protected ClientInterface $client;
3232

33+
/**
34+
* @psalm-suppress InternalMethod
35+
*/
3336
protected function setUp(): void
3437
{
3538
parent::setUp();
3639
$this->client = $this->createClient();
40+
// if ($this->usesDataProvider()) {
41+
// $data = $this->getProvidedData();
42+
// /** @var string|null */
43+
// $alias = $data[0] ?? null;
44+
// $this->client->run('MATCH (x) DETACH DELETE (x)', [], $alias);
45+
// } else {
46+
// foreach ($this->connectionAliases() as $alias) {
47+
// $this->client->run('MATCH (x) DETACH DELETE (x)', [], $alias[0]);
48+
// }
49+
// }
3750
}
3851

3952
/**
@@ -49,21 +62,13 @@ protected function createClient(): ClientInterface
4962
$connections = $this->getConnections();
5063

5164
$builder = ClientBuilder::create();
52-
$aliases = [];
5365
foreach ($connections as $i => $connection) {
5466
$uri = Uri::create($connection);
5567
$alias = $uri->getScheme().'_'.$i;
56-
$aliases[] = $alias;
5768
$builder = $builder->withDriver($alias, $connection);
5869
}
5970

60-
$client = $builder->withFormatter($this->formatter())->build();
61-
62-
foreach ($aliases as $alias) {
63-
$client->run('MATCH (x) DETACH DELETE x', [], $alias);
64-
}
65-
66-
return $client;
71+
return $builder->withFormatter($this->formatter())->build();
6772
}
6873

6974
/**

tests/Integration/OGMFormatterIntegrationTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,7 @@ public function testPath2(string $alias): void
468468
*/
469469
public function testPathMultiple(string $alias): void
470470
{
471+
$this->client->run('MATCH (x) DETACH DELETE (x)', [], $alias);
471472
$this->client->run('CREATE (:Node) - [:HasNode] -> (:Node)', [], $alias);
472473
$this->client->run('CREATE (:Node) - [:HasNode] -> (:Node)', [], $alias);
473474

0 commit comments

Comments
 (0)