wantTo('generate model factories without fields'); $I->runShellCommand('php artisan wn:factory "App\Task"'); $I->seeInShellOutput('App\Task factory generated'); $I->openFile('./database/factories/ModelFactory.php'); $I->seeInThisFile(' $factory->define(App\Task::class, function ($faker) { return [ // Fields here ]; });'); $I->writeToFile('./database/factories/ModelFactory.php', "define(App\User::class, function (\$faker) { return [ 'name' => \$faker->name, 'email' => \$faker->email, 'password' => str_random(10), 'remember_token' => str_random(10), ]; }); "); $I->wantTo('generate model factories with fields'); $I->runShellCommand('php artisan wn:factory "App\Task" --fields="title:sentence(3),description:paragraph(3),due:date,hidden:boolean"'); $I->seeInShellOutput('App\Task factory generated'); $I->openFile('./database/factories/ModelFactory.php'); $I->seeInThisFile(" 'title' => \$faker->sentence(3), 'description' => \$faker->paragraph(3), 'due' => \$faker->date, 'hidden' => \$faker->boolean, "); $I->writeToFile('./database/factories/ModelFactory.php', "define(App\User::class, function (\$faker) { return [ 'name' => \$faker->name, 'email' => \$faker->email, 'password' => str_random(10), 'remember_token' => str_random(10), ]; }); ");