2021-11-28 17:43:02 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace CuyZ\Valinor\Tests\Unit\Definition;
|
|
|
|
|
|
|
|
use CuyZ\Valinor\Definition\ParameterDefinition;
|
|
|
|
use CuyZ\Valinor\Tests\Fake\Definition\FakeAttributes;
|
|
|
|
use CuyZ\Valinor\Tests\Fake\Type\FakeType;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
|
|
|
final class ParameterDefinitionTest extends TestCase
|
|
|
|
{
|
|
|
|
public function test_parameter_data_can_be_retrieved(): void
|
|
|
|
{
|
|
|
|
$name = 'someParameter';
|
|
|
|
$signature = 'someParameterSignature';
|
|
|
|
$type = new FakeType();
|
|
|
|
$isOptional = true;
|
2022-02-18 18:29:08 +01:00
|
|
|
$isVariadic = true;
|
2021-11-28 17:43:02 +01:00
|
|
|
$defaultValue = 'Some parameter default value';
|
|
|
|
$attributes = new FakeAttributes();
|
|
|
|
|
|
|
|
$parameter = new ParameterDefinition(
|
|
|
|
$name,
|
|
|
|
$signature,
|
|
|
|
$type,
|
|
|
|
$isOptional,
|
2022-02-18 18:29:08 +01:00
|
|
|
$isVariadic,
|
2021-11-28 17:43:02 +01:00
|
|
|
$defaultValue,
|
|
|
|
$attributes
|
|
|
|
);
|
|
|
|
|
|
|
|
self::assertSame($name, $parameter->name());
|
|
|
|
self::assertSame($signature, $parameter->signature());
|
|
|
|
self::assertSame($type, $parameter->type());
|
|
|
|
self::assertSame($isOptional, $parameter->isOptional());
|
2022-02-18 18:29:08 +01:00
|
|
|
self::assertSame($isVariadic, $parameter->isVariadic());
|
2021-11-28 17:43:02 +01:00
|
|
|
self::assertSame($defaultValue, $parameter->defaultValue());
|
|
|
|
self::assertSame($attributes, $parameter->attributes());
|
|
|
|
}
|
|
|
|
}
|