Skip to content

Commit b5c8079

Browse files
author
Kirill Nesmeyanov
committed
Add unit enum tests
1 parent 403ea77 commit b5c8079

File tree

2 files changed

+278
-0
lines changed

2 files changed

+278
-0
lines changed

tests/Context/Provider/TypeContext/EnumTypeContext.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
use Behat\Step\Given;
88
use TypeLang\Mapper\Tests\Stub\IntBackedEnumStub;
99
use TypeLang\Mapper\Tests\Stub\StringBackedEnumStub;
10+
use TypeLang\Mapper\Tests\Stub\UnitEnumStub;
1011
use TypeLang\Mapper\Type\BackedEnumType;
1112
use TypeLang\Mapper\Type\IntType;
1213
use TypeLang\Mapper\Type\StringType;
14+
use TypeLang\Mapper\Type\UnitEnumType;
1315

1416
/**
1517
* @api
@@ -34,4 +36,16 @@ class: StringBackedEnumStub::class,
3436
type: new StringType(),
3537
));
3638
}
39+
40+
#[Given('/^type "unit-enum"$/')]
41+
public function givenUnitEnumType(): void
42+
{
43+
$this->setCurrent(new UnitEnumType(
44+
class: UnitEnumStub::class,
45+
cases: \array_map(static function (UnitEnumStub $case): string {
46+
return $case->name;
47+
}, UnitEnumStub::cases()),
48+
type: new StringType(),
49+
));
50+
}
3751
}

0 commit comments

Comments
 (0)