2021-11-28 17:43:02 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace CuyZ\Valinor\Tests\Unit\Mapper;
|
|
|
|
|
|
|
|
use CuyZ\Valinor\Mapper\Exception\InvalidMappingTypeSignature;
|
|
|
|
use CuyZ\Valinor\Mapper\Tree\Builder\RootNodeBuilder;
|
|
|
|
use CuyZ\Valinor\Mapper\TreeMapperContainer;
|
|
|
|
use CuyZ\Valinor\Tests\Fake\Mapper\Tree\Builder\FakeNodeBuilder;
|
|
|
|
use CuyZ\Valinor\Tests\Fake\Type\Parser\FakeTypeParser;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
|
|
|
final class TreeMapperContainerTest extends TestCase
|
|
|
|
{
|
|
|
|
private TreeMapperContainer $mapper;
|
|
|
|
|
|
|
|
protected function setUp(): void
|
|
|
|
{
|
|
|
|
parent::setUp();
|
|
|
|
|
|
|
|
$this->mapper = new TreeMapperContainer(
|
|
|
|
new FakeTypeParser(),
|
|
|
|
new RootNodeBuilder(new FakeNodeBuilder()),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function test_invalid_mapping_type_signature_throws_exception(): void
|
|
|
|
{
|
|
|
|
$this->expectException(InvalidMappingTypeSignature::class);
|
|
|
|
$this->expectExceptionCode(1630959692);
|
|
|
|
$this->expectExceptionMessageMatches('/^Could not parse the type `foo` that should be mapped: .*/');
|
|
|
|
|
2021-12-29 00:09:34 +01:00
|
|
|
$this->mapper->map('foo', []);
|
2021-11-28 17:43:02 +01:00
|
|
|
}
|
|
|
|
}
|