/** * @dataProvider calendarMonthsCases */ public function testCalculatesDiffInCalendarMonths(DI $date, DI $baseDate, $expectedCalendarMonths) { $request = new DateDiffRequest($date, $baseDate); $this->assertSame($expectedCalendarMonths, $request->getCalendarMonths()); }
/** * Returns "months ago" result with absolute diff in calendar months * @param DateDiffRequest $request * @return DateDiffResult */ public static function calculateMonthsAgo(DateDiffRequest $request) { return new DateDiffResult($request, self::MONTHS_AGO, abs($request->getCalendarMonths())); }
public function isApplicable(DateDiffRequest $diffRequest) { return $diffRequest->getCalendarMonths() < 0; }