Skip to content

Commit

Permalink
Merge pull request #235 from JonPurvis/add-to-be-between-docs
Browse files Browse the repository at this point in the history
add docs for `toBeBetween` expectation
  • Loading branch information
nunomaduro authored Sep 29, 2023
2 parents deb5116 + 925f1fe commit 1d01eb4
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions expectations.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ With the Pest expectation API, you have access to an extensive collection of ind

- [`toBe()`](#expect-toBe)
- [`toBeArray()`](#expect-toBeArray)
- [`toBeBetween()`](#expect-toBeBetween)
- [`toBeEmpty()`](#expect-toBeEmpty)
- [`toBeTrue()`](#expect-toBeTrue)
- [`toBeTruthy()`](#expect-toBeTruthy)
Expand Down Expand Up @@ -143,6 +144,23 @@ expect('1')->not->toBe(1);
expect(new StdClass())->not->toBe(new StdClass());
```

<a name="expect-toBeBetween"></a>
### `toBeBetween()`

This expectation ensures that `$value` is between 2 values. It works with `int`,
`float` and `DateTime`.

```php
expect(2)->toBeBetween(1, 3);
expect(1.5)->toBeBetween(1, 2);

$expectationDate = new DateTime('2023-09-22');
$oldestDate = new DateTime('2023-09-21');
$latestDate = new DateTime('2023-09-23');

expect($expectationDate)->toBeBetween($oldestDate, $latestDate);
```

<a name="expect-toBeEmpty"></a>
### `toBeEmpty()`

Expand Down

0 comments on commit 1d01eb4

Please sign in to comment.