Files
animethemes-server/tests/Unit/Actions/Storage/Base/PruneResultsTest.php
T

50 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
use App\Actions\Storage\Base\PruneResults;
use App\Enums\Actions\ActionStatus;
use Illuminate\Foundation\Testing\WithFaker;
uses(WithFaker::class);
test('default', function (): void {
$pruneResults = new PruneResults(fake()->word());
$result = $pruneResults->toActionResult();
$this->assertTrue($result->hasFailed());
});
test('failed', function (): void {
$prunings = [];
foreach (range(0, fake()->randomDigitNotNull()) as $ignored) {
$prunings[fake()->word()] = true;
}
foreach (range(0, fake()->randomDigitNotNull()) as $ignored) {
$prunings[fake()->word()] = false;
}
$pruneResults = new PruneResults(fake()->word(), $prunings);
$result = $pruneResults->toActionResult();
$this->assertTrue($result->hasFailed());
});
test('passed', function (): void {
$prunings = [];
foreach (range(0, fake()->randomDigitNotNull()) as $ignored) {
$prunings[fake()->word()] = true;
}
$pruneResults = new PruneResults(fake()->word(), $prunings);
$result = $pruneResults->toActionResult();
$this->assertTrue($result->getStatus() === ActionStatus::PASSED);
});