2022-12-04 11:38:11 +00:00
|
|
|
<?php
|
|
|
|
namespace Database\Factories;
|
2022-12-04 19:53:27 +00:00
|
|
|
use App\Testing\JikanDataGenerator;
|
2022-12-04 11:38:11 +00:00
|
|
|
use App\Person;
|
2022-12-04 19:53:27 +00:00
|
|
|
use MongoDB\BSON\UTCDateTime;
|
2022-12-04 11:38:11 +00:00
|
|
|
|
|
|
|
|
2022-12-15 14:47:09 +00:00
|
|
|
class PersonFactory extends JikanModelFactory
|
2022-12-04 11:38:11 +00:00
|
|
|
{
|
|
|
|
use JikanDataGenerator;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The name of the factory's corresponding model.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $model = Person::class;
|
|
|
|
|
2022-12-15 14:47:09 +00:00
|
|
|
protected function definitionInternal(): array
|
2022-12-04 11:38:11 +00:00
|
|
|
{
|
|
|
|
$mal_id = $this->createMalId();
|
|
|
|
$name = $this->faker->name();
|
|
|
|
$given_name = $this->faker->firstName();
|
|
|
|
$family_name = $this->faker->lastName();
|
|
|
|
|
|
|
|
return [
|
|
|
|
"mal_id" => $mal_id,
|
2022-12-10 21:16:05 +00:00
|
|
|
"url" => $this->createMalUrl($mal_id, "people"),
|
2022-12-04 11:38:11 +00:00
|
|
|
"website_url" => "https://webiste.example",
|
2023-02-05 00:55:11 +00:00
|
|
|
"images" => [
|
|
|
|
"jpg" => [
|
|
|
|
"image_url" => "https://cdn.myanimelist.net/images/voiceactors/1/55486.jpg"
|
|
|
|
]
|
|
|
|
],
|
2022-12-04 11:38:11 +00:00
|
|
|
"name" => $name,
|
|
|
|
"given_name" => $given_name,
|
|
|
|
"family_name" => $family_name,
|
2023-02-05 00:55:11 +00:00
|
|
|
"alternate_names" => [
|
|
|
|
$this->faker->name()
|
|
|
|
],
|
2022-12-04 11:38:11 +00:00
|
|
|
"birthday" => $this->createRandomDateTime("-80 years")->toAtomString(),
|
2023-02-05 00:55:11 +00:00
|
|
|
"member_favorites" => $this->faker->randomDigitNotNull(),
|
2022-12-04 19:53:27 +00:00
|
|
|
"about" => "test",
|
|
|
|
"createdAt" => new UTCDateTime(),
|
|
|
|
"modifiedAt" => new UTCDateTime(),
|
2023-02-05 00:55:11 +00:00
|
|
|
"request_hash" => sprintf("request:%s:%s", "v4", $this->getItemTestUrl("people", $mal_id)),
|
|
|
|
"published_manga" => [],
|
|
|
|
"voice_acting_roles" => [],
|
|
|
|
"anime_staff_positions" => []
|
2022-12-04 11:38:11 +00:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|