20 lines
561 B
PHP
20 lines
561 B
PHP
<?php
|
|
|
|
use App\Models\RejectionReason;
|
|
use App\Models\Report;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
test('rejection reason uses polymorphic relation', function () {
|
|
$report = Report::factory()->create();
|
|
$rejection = RejectionReason::factory()->create([
|
|
'rejectable_type' => Report::class,
|
|
'rejectable_id' => $report->id,
|
|
'reason' => 'Invalid link',
|
|
]);
|
|
|
|
expect($rejection->reason)->toBe('Invalid link');
|
|
expect($rejection->rejectable)->toBeInstanceOf(Report::class);
|
|
});
|