Valinor/tests/Unit/Mapper/Tree/Builder/CasterNodeBuilderTest.php
Romain Canon 396f64a524 feat: initial release
🎉
2021-11-28 18:21:56 +01:00

27 lines
817 B
PHP

<?php
declare(strict_types=1);
namespace CuyZ\Valinor\Tests\Unit\Mapper\Tree\Builder;
use CuyZ\Valinor\Mapper\Tree\Builder\CasterNodeBuilder;
use CuyZ\Valinor\Mapper\Tree\Builder\RootNodeBuilder;
use CuyZ\Valinor\Mapper\Tree\Exception\NoCasterForType;
use CuyZ\Valinor\Mapper\Tree\Shell;
use CuyZ\Valinor\Tests\Fake\Type\FakeType;
use PHPUnit\Framework\TestCase;
final class CasterNodeBuilderTest extends TestCase
{
public function test_no_caster_found_throws_exception(): void
{
$type = new FakeType();
$this->expectException(NoCasterForType::class);
$this->expectExceptionCode(1630693475);
$this->expectExceptionMessage("No caster was found to convert to type `$type`.");
(new RootNodeBuilder(new CasterNodeBuilder([])))->build(Shell::root($type, []));
}
}