Annotation of embedaddon/php/ext/date/tests/bug43452.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #43452 ("weekday" is not equivalent to "1 weekday" of the current weekday is "weekday")
! 3: --FILE--
! 4: <?php
! 5: date_default_timezone_set('Europe/Oslo');
! 6: // <day> is equivalent to 1 <day> and will *not* forward if the current day
! 7: // (November 1st) is the same day of week.
! 8: $day = strtotime( "Thursday Nov 2007" );
! 9: echo date( DateTime::ISO8601, $day ), "\n";
! 10: $day = strtotime( "1 Thursday Nov 2007" );
! 11: echo date( DateTime::ISO8601, $day ), "\n";
! 12: $day = strtotime( "2 Thursday Nov 2007" );
! 13: echo date( DateTime::ISO8601, $day ), "\n";
! 14: $day = strtotime( "3 Thursday Nov 2007" );
! 15: echo date( DateTime::ISO8601, $day ), "\n\n";
! 16:
! 17: // forward one week, then behaves like above for week days
! 18: $day = strtotime( "Thursday Nov 2007" );
! 19: echo date( DateTime::ISO8601, $day ), "\n";
! 20: $day = strtotime( "+1 week Thursday Nov 2007" );
! 21: echo date( DateTime::ISO8601, $day ), "\n";
! 22: $day = strtotime( "+2 week Thursday Nov 2007" );
! 23: echo date( DateTime::ISO8601, $day ), "\n";
! 24: $day = strtotime( "+3 week Thursday Nov 2007" );
! 25: echo date( DateTime::ISO8601, $day ), "\n\n";
! 26:
! 27: // First, second, etc skip to the first/second weekday *after* the current day.
! 28: // This makes "first thursday" equivalent to "+1 week thursday" - but only
! 29: // if the current day-of-week is the one mentioned in the phrase.
! 30: $day = strtotime( "Thursday Nov 2007" );
! 31: echo date( DateTime::ISO8601, $day ), "\n";
! 32: $day = strtotime( "first Thursday Nov 2007" );
! 33: echo date( DateTime::ISO8601, $day ), "\n";
! 34: $day = strtotime( "second Thursday Nov 2007" );
! 35: echo date( DateTime::ISO8601, $day ), "\n";
! 36: $day = strtotime( "third Thursday Nov 2007" );
! 37: echo date( DateTime::ISO8601, $day ), "\n\n";
! 38:
! 39: // Now the same where the current day-of-week does not match the one in the
! 40: // phrase.
! 41: $day = strtotime( "Friday Nov 2007" );
! 42: echo date( DateTime::ISO8601, $day ), "\n";
! 43: $day = strtotime( "first Friday Nov 2007" );
! 44: echo date( DateTime::ISO8601, $day ), "\n";
! 45: $day = strtotime( "second Friday Nov 2007" );
! 46: echo date( DateTime::ISO8601, $day ), "\n";
! 47: $day = strtotime( "third Friday Nov 2007" );
! 48: echo date( DateTime::ISO8601, $day ), "\n\n";
! 49:
! 50: ?>
! 51: --EXPECT--
! 52: 2007-11-01T00:00:00+0100
! 53: 2007-11-01T00:00:00+0100
! 54: 2007-11-08T00:00:00+0100
! 55: 2007-11-15T00:00:00+0100
! 56:
! 57: 2007-11-01T00:00:00+0100
! 58: 2007-11-08T00:00:00+0100
! 59: 2007-11-15T00:00:00+0100
! 60: 2007-11-22T00:00:00+0100
! 61:
! 62: 2007-11-01T00:00:00+0100
! 63: 2007-11-08T00:00:00+0100
! 64: 2007-11-15T00:00:00+0100
! 65: 2007-11-22T00:00:00+0100
! 66:
! 67: 2007-11-02T00:00:00+0100
! 68: 2007-11-02T00:00:00+0100
! 69: 2007-11-09T00:00:00+0100
! 70: 2007-11-16T00:00:00+0100
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>