36 lines
931 B
PHP
36 lines
931 B
PHP
<?php
|
|
|
|
namespace Tests\Feature\Website;
|
|
|
|
use App\Models\Website\Service;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Tests\TestCase;
|
|
|
|
class ServiceTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_can_list_services()
|
|
{
|
|
Service::factory()->count(3)->create();
|
|
|
|
$response = $this->getJson('/api/website/services/en');
|
|
|
|
$response->assertStatus(200);
|
|
$this->assertCount(3, $response->json());
|
|
}
|
|
|
|
public function test_can_get_service_translation()
|
|
{
|
|
$service = Service::factory()->create();
|
|
$service->setTranslation('title', 'fa', 'عنوان');
|
|
$service->setTranslation('description', 'fa', 'توضیحات');
|
|
$service->save();
|
|
|
|
$response = $this->getJson("/api/website/services/{$service->id}/translation/fa");
|
|
|
|
$response->assertStatus(200)
|
|
->assertJson(['title' => 'عنوان']);
|
|
}
|
|
}
|