Files
vkv/tests/Feature/Catalog/CountryWwlControllerTest.php
Zdeněk Burda 41e3ce6f25 Initial commit
2026-01-09 21:26:40 +01:00

47 lines
1.1 KiB
PHP

<?php
namespace Tests\Feature\Catalog;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class CountryWwlControllerTest extends TestCase
{
use RefreshDatabase;
public function test_index_returns_country_wwl_records(): void
{
$item = $this->createCountryWwl();
$response = $this->getJson('/api/countries-wwl');
$response->assertStatus(200)
->assertJsonFragment([
'country_name' => $item->country_name,
'wwl' => $item->wwl,
]);
}
public function test_admin_can_create_country_wwl(): void
{
$this->actingAsAdmin();
$createResponse = $this->postJson('/api/countries-wwl', [
'country_name' => 'Test Country',
'wwl' => 'AA00',
]);
$createResponse->assertStatus(201);
}
public function test_non_admin_cannot_create_country_wwl(): void
{
$this->actingAsUser();
$this->postJson('/api/countries-wwl', [
'country_name' => 'Test Country',
'wwl' => 'AA00',
])->assertStatus(403);
}
}