30 lines
972 B
PHP
30 lines
972 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Models\BackupSet;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
it('keeps the default backup set factory path free of backup item side effects', function (): void {
|
|
$backupSet = BackupSet::factory()->create();
|
|
|
|
expect($backupSet->item_count)->toBe(0)
|
|
->and($backupSet->items()->count())->toBe(0);
|
|
});
|
|
|
|
it('can opt into a fuller backup graph with explicit items', function (): void {
|
|
$backupSet = BackupSet::factory()->full()->create();
|
|
|
|
expect($backupSet->item_count)->toBe(1)
|
|
->and($backupSet->items()->count())->toBe(1);
|
|
});
|
|
|
|
it('keeps stale and degraded backup item graphs behind explicit named states', function (): void {
|
|
$stale = BackupSet::factory()->staleCompleted()->create();
|
|
$degraded = BackupSet::factory()->degradedCompleted()->create();
|
|
|
|
expect($stale->items()->count())->toBe(1)
|
|
->and($degraded->items()->count())->toBe(1);
|
|
}); |