Skip to content

Commit 1501444

Browse files
NeoRazorXclaude
andcommitted
Fix random collisions in tests widening mt_rand ranges
Increase mt_rand range from (1, 99) to (1, 999999) in getRandomProvince and from (1, 999) to (1, 999999) in ProductoTest::getTestSupplier to avoid duplicate key errors on CI. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5f2d7e7 commit 1501444

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

Test/Core/Model/ProductoTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ private function getTestProduct(): Producto
764764

765765
private function getTestSupplier(): Proveedor
766766
{
767-
$num = mt_rand(1, 999);
767+
$num = mt_rand(1, 999999);
768768
$supplier = new Proveedor();
769769
$supplier->codproveedor = 'TEST' . $num;
770770
$supplier->nombre = 'Test Supplier ' . $num;

Test/Traits/RandomDataTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ protected function getRandomProduct(): Producto
170170
protected function getRandomProvince(string $codpais): Provincia
171171
{
172172
$province = new Provincia();
173-
$province->provincia = 'Test Province ' . mt_rand(1, 99);
173+
$province->provincia = 'Test Province ' . mt_rand(1, 999999);
174174
$province->codpais = $codpais;
175175
$province->alias = 'TP' . mt_rand(1, 999);
176176

0 commit comments

Comments
 (0)