Initial commit

This commit is contained in:
Zdeněk Burda
2026-01-09 21:26:40 +01:00
parent e83aec6dca
commit 41e3ce6f25
404 changed files with 61250 additions and 28 deletions

View File

@@ -0,0 +1,46 @@
<?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);
}
}