<?php $I = new DatetimeTester($scenario); $I->wantTo('Test the time comparison module'); $t1 = date('H:i:s'); // Today $t2 = date('H:i:s', strtotime('+2 hours')); // Today plus two hours $I->seeTimeMatches($t1, $t1); $I->dontSeeTimeMatches($t1, $t2); $I->seeTimeInFuture(date('H:i:s', strtotime('+2 hours'))); // Today plus 2 hours $I->dontSeeTimeInFuture(date('H:i:s', strtotime('-2 hours'))); // Today less 2 hours $I->seeTimeInPast(date('H:i:s', strtotime('-2 hours'))); // Today less 2 hours $I->dontSeeTimeInPast(date('H:i:s', strtotime('+2 hours'))); // Today plus 2 hours $I->seeTimeIsInSecs(date('H:i:s', strtotime('+2 seconds')), 2); // Today plus 2 seconds $I->dontSeeTimeIsInSecs(date('H:i:s', strtotime('+4 seconds')), 2); // Today plus 4 seconds $I->seeTimeWasInSecs(date('H:i:s', strtotime('-2 seconds')), 2); // Today less 2 seconds $I->dontSeeTimeWasInSecs(date('H:i:s', strtotime('-4 seconds')), 2); // Today less 4 seconds $I->seeTimeIsInMins(date('H:i:s', strtotime('+2 minutes')), 2); // Today plus 2 minutes $I->dontSeeTimeIsInMins(date('H:i:s', strtotime('+4 minutes')), 2); // Today plus 4 minutes $I->seeTimeWasInMins(date('H:i:s', strtotime('-2 minutes')), 2);
<?php $I = new DatetimeTester($scenario); $I->wantTo('Test the date comparison module'); $d1 = date('r'); // Today $d2 = date('r', strtotime('+ 1 month')); // Today plus one month $I->seeDateMatches($d1, $d1); $I->dontSeeDateMatches($d1, $d2); $I->seeDateIsToday(date('r')); // Today $I->dontSeeDateIsToday(date('r', strtotime('+ 1 week'))); // Offset by one week $I->seeDateIsTomorrow(date('r', strtotime('+ 1 day'))); // Tomorrow $I->dontSeeDateIsTomorrow(date('r', strtotime('+ 1 week'))); // Offset by one week $I->seeDateWasYesterday(date('r', strtotime('- 1 day'))); // Yesterday $I->dontSeeDateWasYesterday(date('r', strtotime('+ 1 week'))); // Offset by one week $I->seeDateIsInDays(date('r', strtotime('+3 days')), 3); // Today's date plus three days $I->seeDateIsInDays(date('r', strtotime('-25 days')), -25); // Today's date less twenty-five days $I->dontSeeDateIsInDays(date('r', strtotime('+10 days')), 12); // Today's date plus ten days $I->seeDateWasInDays(date('r', strtotime('-3 days')), 3); // Today's date less three days $I->seeDateWasInDays(date('r', strtotime('+25 days')), -25);