@lianmaymesi probably best to do this:
$name = $this->faker->title;
return [
'name' => $name,
'slug' => Str::slug($name),
'description' => $this->faker->paragraph,
'price' => 1000
];
Summer Sale! All accounts are 50% off this week.
I have an error while testing. Below are the code and error.
`public function definition() {
return [
'name' => $name = $this->faker->title,
'slug' => Str::slug($name),
'description' => $this->faker->paragraph,
'price' => 1000
];
}
at C:\xampp\htdocs\Projects\apiMB\vendor\fzaninotto\faker\src\Faker\Generator.php:248 244▕ 245▕ return $this->formatters[$formatter]; 246▕ } 247▕ } ➜ 248▕ throw new \InvalidArgumentException(sprintf('Unknown formatter "%s"', $formatter)); 249▕ } 250▕ 251▕ /** 252▕ * Replaces tokens ('{{ tokenName }}') with the result from the token method call
1 C:\xampp\htdocs\Projects\apiMB\vendor\fzaninotto\faker\src\Faker\Generator.php:228 Faker\Generator::getFormatter("name")
2 C:\xampp\htdocs\Projects\apiMB\vendor\fzaninotto\faker\src\Faker\Generator.php:285 Faker\Generator::format("name", [])`
I found, here is the solution, thanks @automica
https://laracasts.com/discuss/channels/testing/getting-unknown-formatter-name-when-running-tests
Please or to participate in this conversation.