|
22 | 22 |
|
23 | 23 | namespace PackageFactory\ComponentEngine\Test\Unit\TypeSystem\Resolver\Match; |
24 | 24 |
|
| 25 | +use PackageFactory\ComponentEngine\Module\ModuleId; |
25 | 26 | use PackageFactory\ComponentEngine\Parser\Ast\EnumDeclarationNode; |
26 | 27 | use PackageFactory\ComponentEngine\Parser\Ast\ExpressionNode; |
27 | 28 | use PackageFactory\ComponentEngine\Parser\Ast\MatchNode; |
28 | 29 | use PackageFactory\ComponentEngine\Test\Unit\TypeSystem\Scope\Fixtures\DummyScope; |
29 | 30 | use PackageFactory\ComponentEngine\TypeSystem\Resolver\Match\MatchTypeResolver; |
30 | 31 | use PackageFactory\ComponentEngine\TypeSystem\Type\BooleanType\BooleanType; |
31 | 32 | use PackageFactory\ComponentEngine\TypeSystem\Type\EnumType\EnumStaticType; |
32 | | -use PackageFactory\ComponentEngine\TypeSystem\Type\EnumType\EnumType; |
33 | 33 | use PackageFactory\ComponentEngine\TypeSystem\Type\NumberType\NumberType; |
34 | 34 | use PackageFactory\ComponentEngine\TypeSystem\Type\StringType\StringType; |
35 | 35 | use PackageFactory\ComponentEngine\TypeSystem\Type\UnionType\UnionType; |
@@ -92,7 +92,8 @@ public function matchExamples(): array |
92 | 92 | */ |
93 | 93 | public function resolvesMatchToResultingType(string $matchAsString, TypeInterface $expectedType): void |
94 | 94 | { |
95 | | - $someStaticEnumType = EnumStaticType::fromEnumDeclarationNode( |
| 95 | + $someStaticEnumType = EnumStaticType::fromModuleIdAndDeclaration( |
| 96 | + ModuleId::fromString("module-a"), |
96 | 97 | EnumDeclarationNode::fromString( |
97 | 98 | 'enum SomeEnum { A B C }' |
98 | 99 | ) |
@@ -196,22 +197,20 @@ public function malformedEnumExamples(): iterable |
196 | 197 | * @dataProvider malformedEnumExamples |
197 | 198 | * @test |
198 | 199 | */ |
199 | | - public function malformedMatchCannotBeResolved(string $matchAsString, string $expectedErrorMessage) |
| 200 | + public function malformedMatchCannotBeResolved(string $matchAsString, string $expectedErrorMessage): void |
200 | 201 | { |
201 | 202 | $this->expectExceptionMessage($expectedErrorMessage); |
202 | | - $someEnumDeclaration = EnumDeclarationNode::fromString( |
203 | | - 'enum SomeEnum { A B C }' |
204 | | - ); |
205 | | - $someEnumType = EnumType::fromEnumDeclarationNode( |
206 | | - $someEnumDeclaration |
207 | | - ); |
208 | | - $someStaticEnumType = EnumStaticType::fromEnumDeclarationNode( |
209 | | - $someEnumDeclaration |
| 203 | + $someStaticEnumType = EnumStaticType::fromModuleIdAndDeclaration( |
| 204 | + ModuleId::fromString("module-a"), |
| 205 | + EnumDeclarationNode::fromString( |
| 206 | + 'enum SomeEnum { A B C }' |
| 207 | + ) |
210 | 208 | ); |
211 | 209 | $scope = new DummyScope([ |
212 | | - 'someEnumValue' => $someEnumType, |
213 | 210 | 'SomeEnum' => $someStaticEnumType, |
214 | | - 'OtherEnum' => EnumStaticType::fromEnumDeclarationNode( |
| 211 | + 'someEnumValue' => $someStaticEnumType->toEnumInstanceType(), |
| 212 | + 'OtherEnum' => EnumStaticType::fromModuleIdAndDeclaration( |
| 213 | + ModuleId::fromString("module-a"), |
215 | 214 | EnumDeclarationNode::fromString('enum OtherEnum { A }') |
216 | 215 | ) |
217 | 216 |
|
|
0 commit comments