Skip to content

๐Ÿ“… A lightweight DateTime plugin for Pest PHP testing framework, with fluent assertions using Carbon.

License

Notifications You must be signed in to change notification settings

tal7aouy/pest-datetime-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“… PestDateTime Plugin

PestDateTime is a plugin for Pest PHP testing framework that provides intuitive date and time assertions using Carbon.

Tests Packagist Version Packagist License

Installation

Install via Composer:

composer require tal7aouy/pest-datetime-plugin

Usage

Example: Checking if Date is Today

use Carbon\Carbon;

test('Check if date is today', function (): void {
    expect(Carbon::now())->toBeToday();
});

Available Assertions

  • toBeToday(): Asserts that the date matches today's date.
  • toBeInThePast(): Asserts that the date is in the past.
  • toBeInTheFuture(): Asserts that the date is in the future.
  • toBeSameDayAs($date): Asserts that the date is the same day as the given $date.
  • toBeWithinLastDays($days): Asserts that the date is within the last $days.
  • toBeWithinNextDays($days): Asserts that the date is within the next $days.
  • toBeOnWeekend(): Asserts that the date falls on a weekend.
  • toBeOnWeekday(): Asserts that the date falls on a weekday.
  • toBeBetweenDates($startDate, $endDate): Asserts that the date falls between $startDate and $endDate.

Contributing

Contributions and feedback are welcome! Please feel free to open issues or submit pull requests.

License

This project is licensed under the MIT License.

About

๐Ÿ“… A lightweight DateTime plugin for Pest PHP testing framework, with fluent assertions using Carbon.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages