@@ -58,7 +58,7 @@ public static function setUpTestFixtures(): void
5858 }
5959 self ::setUpTestDatabase ();
6060
61- self ::$ id1 = rand ( 1000 , 9999 );
61+ self ::$ id1 = self :: randId ( );
6262
6363 self ::$ row = [
6464 'id ' => self ::$ id1 ,
@@ -74,7 +74,7 @@ public static function setUpTestFixtures(): void
7474 public function testRunTransaction ()
7575 {
7676 $ db = self ::$ database ;
77- $ id = rand ( 1 , 346464 );
77+ $ id = self :: randId ( );
7878 $ keySet = new KeySet ([
7979 'keys ' => [$ id ]
8080 ]);
@@ -278,7 +278,7 @@ public function testRunTransactionWithDbRole($db, $values, $expected)
278278
279279 try {
280280 $ db ->runTransaction (function ($ t ) use ($ values ) {
281- $ id = rand ( 1 , 346464 );
281+ $ id = self :: randId ( );
282282 $ t ->insert (self ::TEST_TABLE_NAME , $ values );
283283
284284 $ t ->commit ();
@@ -405,7 +405,7 @@ public function testRunTransactionILBWithMultipleOperations()
405405 $ db = self ::$ database ;
406406
407407 $ res = $ db ->runTransaction (function ($ t ) {
408- $ id = rand ( 1 , 346464 );
408+ $ id = self :: randId ( );
409409 $ row = [
410410 'id ' => $ id ,
411411 'name ' => uniqid (self ::TESTING_PREFIX ),
@@ -415,7 +415,7 @@ public function testRunTransactionILBWithMultipleOperations()
415415 $ t ->insert (self ::TEST_TABLE_NAME , $ row );
416416 $ this ->assertNull ($ t ->id ());
417417
418- $ id = rand ( 1 , 346464 );
418+ $ id = self :: randId ( );
419419 $ t ->executeUpdate (
420420 'INSERT INTO ' . self ::TEST_TABLE_NAME . ' (id, name, birthday) VALUES (@id, @name, @birthday) ' ,
421421 [
@@ -489,7 +489,7 @@ public function testTransactionToChannelAffinity()
489489 };
490490
491491 $ res = $ db ->runTransaction (function ($ t ) use ($ getChannel ) {
492- $ id = rand ( 1 , 346464 );
492+ $ id = self :: randId ( );
493493 $ row = [
494494 'id ' => $ id ,
495495 'name ' => uniqid (self ::TESTING_PREFIX ),
@@ -499,7 +499,7 @@ public function testTransactionToChannelAffinity()
499499 $ t ->insert (self ::TEST_TABLE_NAME , $ row );
500500 $ this ->assertNull ($ t ->id ());
501501
502- $ id = rand ( 1 , 346464 );
502+ $ id = self :: randId ( );
503503 $ t ->executeUpdate (
504504 'INSERT INTO ' . self ::TEST_TABLE_NAME . ' (id, name, birthday) VALUES (@id, @name, @birthday) ' ,
505505 [
@@ -677,7 +677,7 @@ private function getMultipleRows(int $total)
677677 // if $total is 10, then we will generate 9 rows.
678678 for ($ i = 0 ; $ i < $ total ; $ i ++) {
679679 $ rows [] = [
680- 'id ' => rand ( 1 , 346464 ),
680+ 'id ' => self :: randId ( ),
681681 'name ' => uniqid (self ::TESTING_PREFIX ),
682682 'birthday ' => new Date (new \DateTime ('2000-01-01 ' ))
683683 ];
0 commit comments