From 8b1403c0d42408fec7a455c5e8ad30d0dfd9e9b0 Mon Sep 17 00:00:00 2001 From: JonPurvis Date: Sun, 13 Aug 2023 12:11:14 +0100 Subject: [PATCH 1/2] add documentation for toBeUppercase(), toBeLowercase(), toBeAlpha() and toBeAlphaNumeric() --- expectations.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/expectations.md b/expectations.md index 53598ea..44fc38f 100644 --- a/expectations.md +++ b/expectations.md @@ -91,6 +91,10 @@ With the Pest expectation API, you have access to an extensive collection of ind - [`toEndWith()`](#expect-toEndWith) - [`toMatch()`](#expect-toMatch) - [`toMatchConstraint()`](#expect-toMatchConstraint) +- [`toBeUppercase`](#expect-toBeUppercase) +- [`toBeLowercase`](#expect-toBeLowercase) +- [`toBeAlpha`](#expect-toBeAlpha) +- [`toBeAlphaNumeric`](#expect-toBeAlphaNumeric) @@ -665,6 +669,42 @@ use PHPUnit\Framework\Constraint\IsTrue; expect(true)->toMatchConstraint(new IsTrue()); ``` + +### `toBeUppercase(string $expected)` + +This expectation ensures that `$value` is uppercase. + +```php +expect('PESTPHP')->toBeUppercase(); +``` + + +### `toBeLowercase(string $expected)` + +This expectation ensures that `$value` is lowercase. + +```php +expect('pestphp')->toBeLowercase(); +``` + + +### `toBeAlpha(string $expected)` + +This expectation ensures that `$value` only contains alpha characters. + +```php +expect('pestphp')->toBeAlpha(); +``` + + +### `toBeAlphaNumeric(string $expected)` + +This expectation ensures that `$value` only contains alphanumeric characters. + +```php +expect('pestPHP123')->toBeAlpha(); +``` + --- From 64020d04fa99fd0e28bc751ac6dd6a225263da12 Mon Sep 17 00:00:00 2001 From: JonPurvis Date: Sun, 13 Aug 2023 12:12:14 +0100 Subject: [PATCH 2/2] amend method name --- expectations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/expectations.md b/expectations.md index 44fc38f..a9c5914 100644 --- a/expectations.md +++ b/expectations.md @@ -702,7 +702,7 @@ expect('pestphp')->toBeAlpha(); This expectation ensures that `$value` only contains alphanumeric characters. ```php -expect('pestPHP123')->toBeAlpha(); +expect('pestPHP123')->toBeAlphaNumeric(); ``` ---