mirror of
https://github.com/danog/Valinor.git
synced 2024-12-04 10:38:27 +01:00
28 lines
745 B
PHP
28 lines
745 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace CuyZ\Valinor\Tests\Integration\Mapping\Source;
|
|
|
|
use CuyZ\Valinor\Mapper\MappingError;
|
|
use CuyZ\Valinor\Mapper\Source\JsonSource;
|
|
use CuyZ\Valinor\Tests\Integration\IntegrationTest;
|
|
use CuyZ\Valinor\Tests\Integration\Mapping\Fixture\SimpleObject;
|
|
|
|
final class JsonSourceMappingTest extends IntegrationTest
|
|
{
|
|
public function test_json_source_is_mapped_correctly(): void
|
|
{
|
|
try {
|
|
$object = $this->mapperBuilder->mapper()->map(
|
|
SimpleObject::class,
|
|
new JsonSource('{"value": "foo"}')
|
|
);
|
|
} catch (MappingError $error) {
|
|
$this->mappingFail($error);
|
|
}
|
|
|
|
self::assertSame('foo', $object->value);
|
|
}
|
|
}
|