Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Use generator to populate values for numeric fields for Spot provider. #820

Merged
merged 1 commit into from
Feb 4, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/Faker/ORM/Spot/ColumnTypeGuesser.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,20 @@ public function guessFormat(array $field)
return $generator->randomNumber($size + 2) / 100;
};
case 'smallint':
return function () {
return mt_rand(0, 65535);
return function () use ($generator) {
return $generator->numberBetween(0, 65535);
};
case 'integer':
return function () {
return mt_rand(0, intval('2147483647'));
return function () use ($generator) {
return $generator->numberBetween(0, intval('2147483647'));
};
case 'bigint':
return function () {
return mt_rand(0, intval('18446744073709551615'));
return function () use ($generator) {
return $generator->numberBetween(0, intval('18446744073709551615'));
};
case 'float':
return function () {
return mt_rand(0, intval('4294967295'))/mt_rand(1, intval('4294967295'));
return function () use ($generator) {
return $generator->randomFloat(null, 0, intval('4294967295'));
};
case 'string':
$size = isset($field['length']) ? $field['length'] : 255;
Expand Down