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