write tests for azmayesh resources

This commit is contained in:
2024-11-03 14:47:25 +03:30
parent 1a15a5d7ed
commit f37cfdb845
14 changed files with 1124 additions and 4 deletions

View File

@@ -19,14 +19,25 @@ class AzmayeshFactory extends Factory
public function definition(): array
{
return [
'lat' => $this->faker->numerify,
'lng' => $this->faker->numerify,
'azmayesh_type_id' => AzmayeshType::factory(),
'azmayesh_type_name' => function (array $attributes) {
return AzmayeshType::query()->find($attributes['azmayesh_type_id'])->name;
},
'province_id' => Province::factory(),
'province_name' => function (array $attributes) {
return Province::query()->find($attributes['province_id'])->name;
return Province::query()->find($attributes['province_id'])->name_fa;
},
'request_date' => $this->faker->date,
'report_date' => $this->faker->date,
'request_number' => $this->faker->numerify,
'employer' => $this->faker->name,
'contractor' => $this->faker->name,
'work_number' => $this->faker->numerify,
'project_name' => $this->faker->name,
'consultant' => $this->faker->name,
'applicant' => $this->faker->name,
];
}
}

View File

@@ -19,8 +19,8 @@ class AzmayeshSampleFactory extends Factory
{
return [
'azmayesh_id' => Azmayesh::factory(),
'azmayesh_name' => function (array $attributes) {
return Azmayesh::query()->find($attributes['azmayesh_id'])->name;
'azmayesh_project_name' => function (array $attributes) {
return Azmayesh::query()->find($attributes['azmayesh_id'])->project_name;
},
'data' => json_encode(['test']),
];