Files
osint/tests/Feature/InvestigationDeletionTest.php
T
cedry2k1992andClaude Sonnet 5 873699e23e Initial commit: Laravel OSINT platform
Multi-user OSINT investigation tool with owner-controlled per-user and
per-group access grants. Includes Sherlock, theHarvester, crt.sh, WHOIS,
and ip-api.com collectors wired through a pluggable Runner/queue pipeline,
investigation search, and printable/CSV/JSON reporting.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-20 10:22:05 +03:00

46 lines
1.5 KiB
PHP

<?php
namespace Tests\Feature;
use App\Models\Investigation;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class InvestigationDeletionTest extends TestCase
{
use RefreshDatabase;
public function test_owner_can_delete_investigation_and_its_targets_cascade(): void
{
$owner = User::factory()->create();
$investigation = Investigation::factory()->for($owner, 'owner')->create();
$target = $investigation->targets()->create([
'type' => 'username',
'value' => 'someone',
'created_by' => $owner->id,
]);
$this->actingAs($owner)
->delete(route('investigations.destroy', $investigation))
->assertRedirect(route('investigations.index'));
$this->assertDatabaseMissing('investigations', ['id' => $investigation->id]);
$this->assertDatabaseMissing('targets', ['id' => $target->id]);
}
public function test_editor_cannot_delete_investigation(): void
{
$owner = User::factory()->create();
$editor = User::factory()->create();
$investigation = Investigation::factory()->for($owner, 'owner')->create();
$investigation->users()->attach($editor, ['role' => 'editor']);
$this->actingAs($editor)
->delete(route('investigations.destroy', $investigation))
->assertForbidden();
$this->assertDatabaseHas('investigations', ['id' => $investigation->id]);
}
}