Skip to content

Commit f8b683f

Browse files
committed
added tests fixing #149
1 parent f5befb2 commit f8b683f

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

tests/Integration/ComplexQueryTest.php

+44
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ protected static function formatter(): FormatterInterface
4545
return SummarizedResultFormatter::create();
4646
}
4747

48+
protected function setUp(): void
49+
{
50+
parent::setUp();
51+
foreach (self::connectionAliases() as $alias) {
52+
$this->getClient()->run('MATCH (x) DETACH DELETE x', [], $alias[0]);
53+
}
54+
}
55+
4856
protected static function createClient(): ClientInterface
4957
{
5058
$connections = self::buildConnections();
@@ -499,6 +507,42 @@ public function testConstraintHandling(string $alias): void
499507
$session->run("CREATE (test:Test {id: '123'}) RETURN test");
500508
}
501509

510+
/**
511+
* @dataProvider connectionAliases
512+
*/
513+
public function testFetchSize(string $alias): void
514+
{
515+
$client = $this->getClient();
516+
517+
// Add 4000 user nodes
518+
for ($i = 0; $i < 4000; ++$i) {
519+
$client->run('CREATE (user:User)', [], $alias);
520+
}
521+
522+
// Confirm that the database contains 4000 unique user nodes
523+
$userCountResults = $client->run('MATCH (user:User) RETURN COUNT(DISTINCT(ID(user))) as user_count', [], $alias);
524+
$userCount = $userCountResults->getAsMap(0)->getAsInt('user_count');
525+
526+
$this->assertEquals(4000, $userCount);
527+
528+
// Retrieve the ids of all user nodes
529+
$results = $client->run('MATCH (user:User) RETURN ID(user) AS id', [], $alias);
530+
531+
// Loop through the results and add each id to an array
532+
$userIds = [];
533+
foreach ($results as $result) {
534+
$userIds[] = $result->get('id');
535+
}
536+
537+
$this->assertCount(4000, $userIds);
538+
539+
// Check if we have any duplicate ids by removing duplicate values
540+
// from the array.
541+
$uniqueUserIds = array_unique($userIds);
542+
543+
$this->assertEquals($userIds, $uniqueUserIds);
544+
}
545+
502546
/**
503547
* @dataProvider connectionAliases
504548
*/

0 commit comments

Comments
 (0)