mirror of
https://github.com/archtechx/enums.git
synced 2025-12-12 10:54:05 +00:00
add options() method, resolve #2
This commit is contained in:
parent
7c02bbaa73
commit
e01edd128f
4 changed files with 34 additions and 9 deletions
19
tests/Pest/InvokableCasesTest.php
Normal file
19
tests/Pest/InvokableCasesTest.php
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
use ArchTech\Enums\Exceptions\UndefinedCaseError;
|
||||
|
||||
it('can be used as a static method', function () {
|
||||
expect(Status::PENDING())->toBe(0);
|
||||
expect(Status::DONE())->toBe(1);
|
||||
});
|
||||
|
||||
it('can be invoked as an instance', function () {
|
||||
$status = Status::PENDING;
|
||||
|
||||
expect($status())->toBe(0);
|
||||
expect($status())->toBe($status->value);
|
||||
});
|
||||
|
||||
it('throws an error when a nonexistent case is being used', function () {
|
||||
Status::INVALID();
|
||||
})->expectException(UndefinedCaseError::class);
|
||||
Loading…
Add table
Add a link
Reference in a new issue