write tests for azmayesh resources

This commit is contained in:
2024-11-03 14:47:25 +03:30
parent 1a15a5d7ed
commit f37cfdb845
14 changed files with 1124 additions and 4 deletions

View File

@@ -0,0 +1,32 @@
<?php
namespace Tests\Feature\V3\AzmayeshSample;
use App\Models\Azmayesh;
use App\Models\AzmayeshSample;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Tests\TestCase;
class DeleteTest extends TestCase
{
use RefreshDatabase;
/**
* A basic feature test example.
*/
public function test_user_can_delete_azmayesh_sample(): void
{
$user = User::factory()->create();
$azmayeshSample = AzmayeshSample::factory()->create();
$response = $this->actingAs($user)->postJson(route('v3.azmayesh_samples.delete', [$azmayeshSample->id]));
$response->assertOk();
$this->assertDatabaseMissing('azmayesh_samples', [
'azmayesh_id' => $azmayeshSample->azmayesh_id,
'data' => $azmayeshSample->data,
]);
}
}