dis-bench / src /php /php-src /Zend /tests /enum /backed-from-invalid-string.phpt
meddyrat's picture
Replace repository contents with the original corrected artifact
1e94262
Raw History Blame Contribute Delete
338 Bytes
--TEST--
BackedEnum::from() reject invalid string
--FILE--
<?php
enum Suit: string {
case Hearts = 'H';
case Diamonds = 'D';
case Clubs = 'C';
case Spades = 'S';
}
try {
var_dump(Suit::from('A'));
} catch (Error $e) {
echo $e->getMessage() . "\n";
}
?>
--EXPECT--
"A" is not a valid backing value for enum Suit