コード例 #1
0
$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);
// Today's date plus twenty-five days