@@ -314,21 +314,29 @@ public function testValidConnectionCheck(string $alias): void
314
314
/**
315
315
* @dataProvider connectionAliases
316
316
*/
317
- public function testFetchSize (string $ connection ): void
317
+ public function testFetchSize (string $ alias ): void
318
318
{
319
- $ session = $ this ->getClient ()->getDriver ($ connection )->createSession (SessionConfiguration::default ()->withFetchSize (1 ));
319
+ $ this ->fetchSize ($ alias , 1 );
320
+ $ this ->fetchSize ($ alias , 4 );
321
+ $ this ->fetchSize ($ alias , 10 );
322
+ }
323
+
324
+ public function fetchSize (string $ connection , int $ fetchSize ): void
325
+ {
326
+ $ session = $ this ->getClient ()->getDriver ($ connection )->createSession (SessionConfiguration::default ()->withFetchSize ($ fetchSize ));
320
327
$ session ->run ('MATCH (x) DETACH DELETE x ' );
321
328
322
- // Add 4000 user nodes
323
- for ($ i = 0 ; $ i < 4 ; ++$ i ) {
329
+ $ nodesAmount = $ fetchSize * 4 ;
330
+ // Add user nodes
331
+ for ($ i = 0 ; $ i < $ nodesAmount ; ++$ i ) {
324
332
$ session ->run ('CREATE (user:User) ' );
325
333
}
326
334
327
335
// Confirm that the database contains 4000 unique user nodes
328
336
$ userCountResults = $ session ->run ('MATCH (user:User) RETURN COUNT(DISTINCT(ID(user))) as user_count ' );
329
337
$ userCount = $ userCountResults ->getAsCypherMap (0 )->getAsInt ('user_count ' );
330
338
331
- $ this ->assertEquals (4 , $ userCount );
339
+ $ this ->assertEquals ($ nodesAmount , $ userCount );
332
340
333
341
// Retrieve the ids of all user nodes
334
342
$ results = $ session ->run ('MATCH (user:User) RETURN ID(user) AS id ' );
@@ -339,12 +347,12 @@ public function testFetchSize(string $connection): void
339
347
$ userIds [] = $ result ->get ('id ' );
340
348
}
341
349
342
- $ this ->assertCount (4 , $ userIds );
350
+ $ this ->assertCount ($ nodesAmount , $ userIds );
343
351
344
352
// Check if we have any duplicate ids by removing duplicate values
345
353
// from the array.
346
354
$ uniqueUserIds = array_unique ($ userIds );
347
355
348
- $ this ->assertCount (4 , $ uniqueUserIds );
356
+ $ this ->assertCount ($ nodesAmount , $ uniqueUserIds );
349
357
}
350
358
}
0 commit comments