mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-09-03 11:15:04 +02:00
49 lines
1.0 KiB
PHP
49 lines
1.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Unit\Actions;
|
|
|
|
use App\Actions\ActionResult;
|
|
use App\Enums\Actions\ActionStatus;
|
|
use Tests\TestCase;
|
|
|
|
/**
|
|
* Class ActionResultTest.
|
|
*/
|
|
class ActionResultTest extends TestCase
|
|
{
|
|
/**
|
|
* The Action Result has failed if the status is Failed.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function testHasFailed(): void
|
|
{
|
|
$result = new ActionResult(ActionStatus::FAILED());
|
|
|
|
static::assertTrue($result->hasFailed());
|
|
}
|
|
|
|
/**
|
|
* The Action Result has not failed if the status is not Failed.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function testHasNotFailed(): void
|
|
{
|
|
$status = null;
|
|
|
|
while ($status === null) {
|
|
$statusCandidate = ActionStatus::getRandomInstance();
|
|
if (ActionStatus::FAILED()->isNot($statusCandidate)) {
|
|
$status = $statusCandidate;
|
|
}
|
|
}
|
|
|
|
$result = new ActionResult($status);
|
|
|
|
static::assertFalse($result->hasFailed());
|
|
}
|
|
}
|