2021-11-28 17:43:02 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace CuyZ\Valinor\Tests\Unit\Definition;
|
|
|
|
|
|
|
|
use CuyZ\Valinor\Definition\ClassDefinition;
|
|
|
|
use CuyZ\Valinor\Definition\Methods;
|
|
|
|
use CuyZ\Valinor\Definition\Properties;
|
|
|
|
use CuyZ\Valinor\Tests\Fake\Definition\FakeAttributes;
|
|
|
|
use CuyZ\Valinor\Tests\Fake\Definition\FakeMethodDefinition;
|
|
|
|
use CuyZ\Valinor\Tests\Fake\Definition\FakePropertyDefinition;
|
2022-01-13 16:01:35 +01:00
|
|
|
use CuyZ\Valinor\Tests\Fake\Type\FakeType;
|
|
|
|
use CuyZ\Valinor\Type\Types\ClassType;
|
2021-11-28 17:43:02 +01:00
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
use stdClass;
|
|
|
|
|
|
|
|
final class ClassDefinitionTest extends TestCase
|
|
|
|
{
|
|
|
|
public function test_class_data_can_be_retrieved(): void
|
|
|
|
{
|
2022-01-13 16:01:35 +01:00
|
|
|
$type = new ClassType(stdClass::class, ['T' => new FakeType()]);
|
2021-11-28 17:43:02 +01:00
|
|
|
$attributes = new FakeAttributes();
|
|
|
|
$properties = new Properties(FakePropertyDefinition::new());
|
|
|
|
$methods = new Methods(FakeMethodDefinition::new());
|
|
|
|
|
2022-01-13 16:01:35 +01:00
|
|
|
$class = new ClassDefinition($type, $attributes, $properties, $methods);
|
2021-11-28 17:43:02 +01:00
|
|
|
|
2022-01-13 16:01:35 +01:00
|
|
|
self::assertSame(stdClass::class, $class->name());
|
|
|
|
self::assertSame($type, $class->type());
|
2021-11-28 17:43:02 +01:00
|
|
|
self::assertSame($attributes, $class->attributes());
|
|
|
|
self::assertSame($properties, $class->properties());
|
|
|
|
self::assertSame($methods, $class->methods());
|
|
|
|
}
|
|
|
|
}
|