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
47 lines
1.5 KiB
PHP
47 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Flasher\Tests\Prime\Exception;
|
|
|
|
use Flasher\Prime\Exception\FactoryNotFoundException;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
final class FactoryNotFoundExceptionTest extends TestCase
|
|
{
|
|
public function testCreateWithAliasOnly(): void
|
|
{
|
|
$exception = FactoryNotFoundException::create('custom_factory');
|
|
|
|
$this->assertSame('Factory "custom_factory" not found, did you forget to register it?', $exception->getMessage());
|
|
}
|
|
|
|
public function testCreateWithAvailableFactories(): void
|
|
{
|
|
$exception = FactoryNotFoundException::create('custom_factory', ['flasher', 'toastr', 'noty']);
|
|
|
|
$this->assertSame('Factory "custom_factory" not found, did you forget to register it? Available factories: [flasher, toastr, noty]', $exception->getMessage());
|
|
}
|
|
|
|
public function testCreateWithEmptyAvailableFactories(): void
|
|
{
|
|
$exception = FactoryNotFoundException::create('custom_factory', []);
|
|
|
|
$this->assertSame('Factory "custom_factory" not found, did you forget to register it?', $exception->getMessage());
|
|
}
|
|
|
|
public function testIsException(): void
|
|
{
|
|
$exception = FactoryNotFoundException::create('test');
|
|
|
|
$this->assertInstanceOf(\Exception::class, $exception);
|
|
}
|
|
|
|
public function testStaticCreateReturnsInstance(): void
|
|
{
|
|
$exception = FactoryNotFoundException::create('alias');
|
|
|
|
$this->assertInstanceOf(FactoryNotFoundException::class, $exception);
|
|
}
|
|
}
|