You've already forked php-flasher
mirror of
https://github.com/php-flasher/php-flasher.git
synced 2026-04-05 12:32:55 +01:00
40 lines
1.3 KiB
PHP
40 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Flasher\Tests\Prime\Exception;
|
|
|
|
use Flasher\Prime\Exception\CriteriaNotRegisteredException;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
final class CriteriaNotRegisteredExceptionTest extends TestCase
|
|
{
|
|
public function testCreateWithAliasOnly(): void
|
|
{
|
|
$exception = CriteriaNotRegisteredException::create('custom_criteria');
|
|
|
|
$this->assertSame('Criteria "custom_criteria" not found, did you forget to register it?', $exception->getMessage());
|
|
}
|
|
|
|
public function testCreateWithAvailableCriteria(): void
|
|
{
|
|
$exception = CriteriaNotRegisteredException::create('custom_criteria', ['limit', 'order_by', 'filter']);
|
|
|
|
$this->assertSame('Criteria "custom_criteria" not found, did you forget to register it? Available criteria: [limit, order_by, filter]', $exception->getMessage());
|
|
}
|
|
|
|
public function testCreateWithEmptyAvailableCriteria(): void
|
|
{
|
|
$exception = CriteriaNotRegisteredException::create('custom_criteria', []);
|
|
|
|
$this->assertSame('Criteria "custom_criteria" not found, did you forget to register it?', $exception->getMessage());
|
|
}
|
|
|
|
public function testIsException(): void
|
|
{
|
|
$exception = CriteriaNotRegisteredException::create('test');
|
|
|
|
$this->assertInstanceOf(\Exception::class, $exception);
|
|
}
|
|
}
|