Initial commit
This commit is contained in:
46
tests/Feature/Catalog/CountryWwlControllerTest.php
Normal file
46
tests/Feature/Catalog/CountryWwlControllerTest.php
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user