php-circle / entity-factory-generator
Doctrine entity factory generator for test data
dev-master
2019-08-07 23:38 UTC
Requires
- fzaninotto/faker: ^1.8
- illuminate/console: ^5.8
- illuminate/filesystem: ^5.8
- illuminate/support: ^5.8
Requires (Dev)
- laravel-doctrine/orm: ^1.4
- laravel/lumen-framework: ^5.8
- mockery/mockery: ^1.2
- phpunit/phpunit: ^8.2
This package is auto-updated.
Last update: 2024-11-08 11:34:28 UTC
README
Generate factory from an existing entity based on metadata.
Installation
composer require php-circle/entity-factory-generator
Usage
To generate an entity factory run the artisan command:
php artisan doctrine:generate:entities:factory "App\Database\Entities\User"
Factory Result
Actual result is array()
, but you can format to []
.
<?php
$factory->define(App\Database\Entities\Acme::class, static function (Generator $faker): array {
return [
'active' => $faker->boolean,
'age' => $faker->numberBetween(1, 50),
'text' => $faker->text(100),
'email' => $faker->unique(true)->email,
'randomNumber' => $faker->randomNumber(4)
];
});
License
The Laravel Doctrine Factory Generator is free software licensed under the MIT license.