Skip to content

Commit

Permalink
Fix error message based on PHP version
Browse files Browse the repository at this point in the history
  • Loading branch information
cerbero90 committed Oct 1, 2024
1 parent cc54f8d commit 7aa7699
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/BackedEnumTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,8 @@
]);

it('throws a value error when hydrating backed cases with a missing value', fn() => BackedEnum::from(4))
->throws(ValueError::class, '4 is not a valid backing value for enum "Cerbero\Enum\BackedEnum"');
->throwsIf(version_compare(PHP_VERSION, '8.2') == -1, ValueError::class, '4 is not a valid backing value for enum "Cerbero\Enum\BackedEnum"')
->throwsIf(version_compare(PHP_VERSION, '8.2') >= 0, ValueError::class, '4 is not a valid backing value for enum Cerbero\Enum\BackedEnum');

it('retrieves the case hydrated from a value or returns null')
->expect(fn(int $value, ?BackedEnum $case) => BackedEnum::tryFrom($value) === $case)
Expand Down

0 comments on commit 7aa7699

Please sign in to comment.