feat: add toBeSnakeCase

This commit is contained in:
Maurizio
2023-08-17 20:48:18 +02:00
parent f2e31452f2
commit 4951b1b0f9
2 changed files with 35 additions and 0 deletions

View File

@ -1009,4 +1009,16 @@ final class Expectation
return $this;
}
/**
* Asserts that the value is snake_case.
*
* @return self<TValue>
*/
public function toBeSnakeCase(string $message = ''): self
{
Assert::assertTrue((bool) preg_match('/^[\p{Ll}_]+$/u', (string) $this->value), $message);
return $this;
}
}