feat: add toBeUlid assertion and isUlid validation method (#1726)

This commit is contained in:
Sonali dudhia
2026-06-11 14:44:00 +05:30
committed by GitHub
parent 3d5bba93f8
commit 774a340400
3 changed files with 50 additions and 0 deletions

View File

@ -1142,6 +1142,22 @@ final class Expectation
return $this;
}
/**
* Asserts that the value is a ULID.
*
* @return self<TValue>
*/
public function toBeUlid(string $message = ''): self
{
if (! is_string($this->value)) {
InvalidExpectationValue::expected('string');
}
Assert::assertTrue(Str::isUlid($this->value), $message);
return $this;
}
/**
* Asserts that the value is between 2 specified values
*