41 lines
1.2 KiB
PHP
41 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature\Website;
|
|
|
|
use App\Models\Website\Project;
|
|
use App\Models\Website\ProjectCategory;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Tests\TestCase;
|
|
|
|
class ProjectTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_can_list_projects()
|
|
{
|
|
$category = ProjectCategory::factory()->create();
|
|
$category->setTranslation('title', 'fa', 'دسته');
|
|
$category->save();
|
|
|
|
$project = Project::factory()->create(['category_id' => $category->id]);
|
|
$project->setTranslation('title', 'fa', 'پروژه');
|
|
$project->setTranslation('description', 'fa', 'توضیحات');
|
|
$project->save();
|
|
|
|
$response = $this->getJson('/api/website/projects/translation/fa');
|
|
|
|
$response->assertStatus(200);
|
|
$response->assertJsonStructure(['projects', 'categories']);
|
|
}
|
|
|
|
public function test_can_get_single_project()
|
|
{
|
|
$category = ProjectCategory::factory()->create();
|
|
$project = Project::factory()->create(['category_id' => $category->id]);
|
|
|
|
$response = $this->getJson("/api/website/projects/{$project->id}/translation/en");
|
|
|
|
$response->assertStatus(200);
|
|
}
|
|
}
|