Where is your UserFactory file located? In database/factories?
Sep 14, 2019
12
Level 1
My factory is not applied to my test cases
i am working with phpunit when i create model using factory is not create the field i was put in UserFactory, even if i delete UserFactory it created fields, i dont know what is going on.. this userFactory file
use Faker\Generator as Faker;
$factory->define(\App\User::class, function (Faker $faker) {
static $password;
return [
'name' => $faker->name,
'email' => $faker->unique()->safeEmail,
'password' => $password ? : $password =bcrypt('12345678'),
'remember_token' => str_random(80),
'verified' => 1,
];
});
and when use this
$ownerUser = factory(\App\User::class)->create();
and result equal
"name" => "Rollin Ebert"
"email" => "[email protected]"
"password" => "y$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm"
"remember_token" => "kZx1MiWx5G"
"updated_at" => "2019-09-14 12:00:09"
"created_at" => "2019-09-14 12:00:09"
"id" => 11
Please or to participate in this conversation.