Valinor/tests/Integration/Mapping/ReadonlyMappingTest.php

29 lines
728 B
PHP
Raw Normal View History

2021-11-28 17:43:02 +01:00
<?php
declare(strict_types=1);
namespace CuyZ\Valinor\Tests\Integration\Mapping;
use CuyZ\Valinor\Mapper\MappingError;
use CuyZ\Valinor\Tests\Integration\IntegrationTest;
use CuyZ\Valinor\Tests\Integration\Mapping\Fixture\ReadonlyValues;
/**
* @requires PHP >= 8.1
*/
final class ReadonlyMappingTest extends IntegrationTest
{
public function test_single_property_and_constructor_parameter_are_mapped_properly(): void
{
try {
$object = $this->mapperBuilder->mapper()->map(ReadonlyValues::class, [
'value' => 'foo',
]);
} catch (MappingError $error) {
$this->mappingFail($error);
}
self::assertSame('foo', $object->value);
}
}