mirror of
https://github.com/pestphp/pest.git
synced 2026-07-22 01:20:03 +02:00
feat: add toBeUlid assertion and isUlid validation method (#1726)
This commit is contained in:
@@ -98,6 +98,14 @@ final class Str
|
||||
return preg_match('/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iD', $value) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a given value is a valid ULID.
|
||||
*/
|
||||
public static function isUlid(string $value): bool
|
||||
{
|
||||
return preg_match('/^[0-9A-HJKMNP-TV-Z]{26}$/', $value) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a describe block as `$describeDescription` → `$testDescription` format.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user