DEF STUDIO srl

Time Expectations

toBeAfter()

Assert the date is after the given one.

expect('2021-10-20')->toBeAfter(today());

toBeBefore()

Assert the date is before the given one.

expect('2021-10-20')->toBeBefore(today());

toBeBetween()

Assert the date is between the given ones.

expect('2021-10-20')->toBeBetween(today(), today()->addWeek());

toBeBirthday()

Assert the date a birthday.

expect('2021-10-20')->toBeBirthday('1985-10-20');

toBeCurrentDay()

Assert the date is today.

expect(now())->toBeCurrentDay();

toBeCurrentHour()

Assert the date is in the current hour.

expect(now())->toBeCurrentHour();

toBeCurrentMinute()

Assert the date is in the current minute.

expect(now())->toBeCurrentMinute();

toBeCurrentMonth()

Assert the date is in the current month.

expect(now())->toBeCurrentMonth();

toBeCurrentSecond()

Assert the date is in the current second.

expect(now())->toBeCurrentSecond();

toBeCurrentWeek()

Assert the date is in the current week.

expect(now())->toBeCurrentWeek();

toBeCurrentYear()

Assert the date is in the current year.

expect(now())->toBeCurrentYear();

toBeEndOfDay()

Assert the date is end of day.

expect(now())->toBeEndOfDay();

toBeFuture()

Assert the date is in the future.

expect(now()->addYear())->toBeFuture();

toBeFriday()

Assert the date is Friday.

 expect('2021-10-23')->toBeFriday();

toBeLastMonth()

Assert the date is in the last month.

expect(now()->subMonth())->toBeLastMonth();

toBeLastWeek()

Assert the date is in the last week.

expect(now()->subWeek())->toBeLastWeek();

toBeLastYear()

Assert the date is in the last year.

expect(now()->subYear())->toBeLastYear();

toBeMidday()

Assert the date is midday.

expect(now()->subYear())->toBeLastYear();

toBeMidnight()

Assert the date is start of day / midnight.

expect(now()->subYear())->toBeLastYear();

toBeMonday()

Assert the date is Monday.

 expect('2021-10-19')->toBeMonday();

toBeNextMonth()

Assert the date is in the next month.

expect(now()->addMonth())->toBeNextMonth();

toBeNextWeek()

Assert the date is in the next week.

expect(now()->addWeek())->toBeNextWeek();

toBeNextYear()

Assert the date is in the next year.

expect(now()->addYear())->toBeNextYear();

toBePast()

Assert the date is in the past.

expect(now()->subDay())->toBePast();

toBeSameDayAs()

Assert the date is the same day as the given one.

expect('2021-10-20')->toBeSameDayAs(today());

toBeSameHourAs()

Assert the date is the same hour as the given one.

expect('2021-10-20')->toBeSameMonthAs(today());

toBeSameMinuteAs()

Assert the date is the same minute as the given one.

expect('2021-10-20 11:23:37')->toBeSameMinuteAs(now());

toBeSameMonthAs()

Assert the date is the same hour as the given one.

expect('2021-10-20')->toBeSameMonthAs(today());

toBeSameSecondAs()

Assert the date is the same second as the given one.

expect('2021-10-20 22:55:04')->toBeSameSecondAs(now());

toBeSameYearAs()

Assert the date is the same year as the given one.

expect('2020-10-20')->toBeSameMonthAs(today());

toBeSameWeekAs()

Assert the date is the same week as the given one.

expect('2020-10-20')->toBeSameWeekAs(today());

toBeSaturday()

Assert the date is Saturday.

 expect('2021-10-24')->toBeSaturday();

toBeStartOfDay()

Assert the date is start of day / midnight.

 expect('2021-10-24 00:00:00')->toBeStartOfDay();

toBeSunday()

Assert the date is Sunday.

 expect('2021-10-25')->toBeSunday();

toBeToday()

alias for toBeCurrentDay()

 expect(now())->toBeToday();

toBeTomorrow()

Assert the date is tomorrow.

 expect(now()->addDay())->toBeTomorrow();

toBeTuesday()

Assert the date is Tuesday.

 expect('2021-10-20')->toBeTuesday();

toBeThursday()

Assert the date is Thursday.

 expect('2021-10-22')->toBeThursday();

toBeWeekday()

Assert the date is a weekday (between monday and friday).

expect('2020-10-22')->toBeWeekday();

toBeWeekend()

Assert the date is Saturday or Sunday.

expect('2020-10-23')->toBeWeekend();

toBeWednesday()

Assert the date is Wednesday.

 expect('2021-10-21')->toBeWednesday();

toBeYesterday()

Assert the date is yesterday.

 expect('2021-10-21')->toBeYesterday();
Edit this page
Last updated 10 September 2024