From 501409f3898fa16e688ff58b1412b33e9f039cbd Mon Sep 17 00:00:00 2001 From: webchick Date: Thu, 12 Mar 2015 02:56:21 -0700 Subject: [PATCH] Issue #2443655 by daffie, bzrudi71: PostgreSQL: Fix system\Tests\Entity\EntityReferenceFieldTest --- core/modules/system/src/Tests/Entity/EntityUnitTestBase.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/modules/system/src/Tests/Entity/EntityUnitTestBase.php b/core/modules/system/src/Tests/Entity/EntityUnitTestBase.php index a11bce1deb1..89deb62437d 100644 --- a/core/modules/system/src/Tests/Entity/EntityUnitTestBase.php +++ b/core/modules/system/src/Tests/Entity/EntityUnitTestBase.php @@ -188,7 +188,10 @@ abstract class EntityUnitTestBase extends KernelTestBase { protected function generateRandomEntityId($string = FALSE) { srand(time()); do { - $id = $string ? $this->randomMachineName() : mt_rand(1, 0xFFFFFFFF); + // 0x7FFFFFFF is the maximum allowed value for integers that works for all + // Drupal supported databases and is known to work for other databases + // like SQL Server 2014 and Oracle 10 too. + $id = $string ? $this->randomMachineName() : mt_rand(1, 0x7FFFFFFF); } while (isset($this->generatedIds[$id])); $this->generatedIds[$id] = $id;