diff --git a/src/Generators/FactoryGenerator.php b/src/Generators/FactoryGenerator.php index eb0c9b22..43a75bf0 100644 --- a/src/Generators/FactoryGenerator.php +++ b/src/Generators/FactoryGenerator.php @@ -249,6 +249,8 @@ public static function fakerDataType(string $type) 'unsignedsmallinteger' => 'randomDigitNotNull', 'biginteger' => 'randomNumber()', 'smallint' => 'randomNumber()', + 'tinyinteger' => 'randomNumber()', + 'smallinteger' => 'randomNumber()', 'decimal' => 'randomFloat(/** decimal_attributes **/)', 'float' => 'randomFloat(/** float_attributes **/)', 'longtext' => 'text', diff --git a/tests/Feature/Generator/FactoryGeneratorTest.php b/tests/Feature/Generator/FactoryGeneratorTest.php index 15f92528..9b0e627a 100644 --- a/tests/Feature/Generator/FactoryGeneratorTest.php +++ b/tests/Feature/Generator/FactoryGeneratorTest.php @@ -152,6 +152,7 @@ public function modelTreeDataProvider() ['drafts/unconventional-foreign-key.yaml', 'database/factories/StateFactory.php', 'factories/unconventional-foreign-key.php'], ['drafts/foreign-key-shorthand.yaml', 'database/factories/CommentFactory.php', 'factories/foreign-key-shorthand.php'], ['drafts/resource-statements.yaml', 'database/factories/UserFactory.php', 'factories/resource-statements.php'], + ['drafts/factory-smallint-and-tinyint.yaml', 'database/factories/ModelFactory.php', 'factories/factory-smallint-and-tinyint.php'], ]; } } diff --git a/tests/fixtures/drafts/factory-smallint-and-tinyint.yaml b/tests/fixtures/drafts/factory-smallint-and-tinyint.yaml new file mode 100644 index 00000000..a80f7b9f --- /dev/null +++ b/tests/fixtures/drafts/factory-smallint-and-tinyint.yaml @@ -0,0 +1,4 @@ +models: + Model: + market_type: tinyInteger + deposit: smallInteger unsigned diff --git a/tests/fixtures/factories/factory-smallint-and-tinyint.php b/tests/fixtures/factories/factory-smallint-and-tinyint.php new file mode 100644 index 00000000..a02b4675 --- /dev/null +++ b/tests/fixtures/factories/factory-smallint-and-tinyint.php @@ -0,0 +1,13 @@ +define(Model::class, function (Faker $faker) { + return [ + 'market_type' => $faker->randomNumber(), + 'deposit' => $faker->randomNumber(), + ]; +});