mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
add to be backed enum expectation
This commit is contained in:
9
tests/Features/Expect/toBeIntBackedEnum.php
Normal file
9
tests/Features/Expect/toBeIntBackedEnum.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
test('enum is backed by int')
|
||||
->expect('Tests\Fixtures\Arch\ToBeIntBackedEnum\HasIntBacking')
|
||||
->toBeIntBackedEnum();
|
||||
|
||||
test('enum is not backed by int')
|
||||
->expect('Tests\Fixtures\Arch\ToBeIntBackedEnum\HasStringBacking')
|
||||
->not->toBeIntBackedEnum();
|
||||
9
tests/Features/Expect/toBeStringBackedEnum.php
Normal file
9
tests/Features/Expect/toBeStringBackedEnum.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
test('enum is backed by string')
|
||||
->expect('Tests\Fixtures\Arch\ToBeStringBackedEnum\HasStringBacking')
|
||||
->toBeStringBackedEnum();
|
||||
|
||||
test('enum is not backed by string')
|
||||
->expect('Tests\Fixtures\Arch\ToBeStringBackedEnum\HasIntBacking')
|
||||
->not->toBeStringBackedEnum();
|
||||
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Fixtures\Arch\ToBeIntBackedEnum\HasIntBacking;
|
||||
|
||||
enum HasIntBackingEnum: int
|
||||
{
|
||||
case IntBacked = 1;
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Fixtures\Arch\ToBeIntBackedEnum\HasStringBacking;
|
||||
|
||||
enum HasStringBackingEnum: string
|
||||
{
|
||||
case StringBacked = 'Testing';
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Fixtures\Arch\ToBeStringBackedEnum\HasIntBacking;
|
||||
|
||||
enum HasIntBackingEnum: int
|
||||
{
|
||||
case IntBacked = 1;
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Fixtures\Arch\ToBeStringBackedEnum\HasStringBacking;
|
||||
|
||||
enum HasStringBackingEnum: string
|
||||
{
|
||||
case StringBacked = 'Testing';
|
||||
}
|
||||
Reference in New Issue
Block a user