Annotation of embedaddon/php/ext/date/tests/date_create-relative.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: date_create() with large relative offsets
        !             3: --FILE--
        !             4: <?php
        !             5: 
        !             6: date_default_timezone_set('UTC');
        !             7: 
        !             8: if (!defined('PHP_INT_MIN')) {
        !             9:        define('PHP_INT_MIN', intval(-PHP_INT_MAX - 1));
        !            10: }
        !            11: 
        !            12: $base_time = '28 Feb 2008 12:00:00'; 
        !            13: 
        !            14: // Most offsets tested in strtotime-relative.phpt. These are tests for dates outside the 32-bit range.
        !            15: $offsets = array(
        !            16:        // around 10 leap year periods (4000 years) in days
        !            17:        '1460000 days',
        !            18:        '1460969 days',
        !            19:        '1460970 days',
        !            20:        '1460971 days',
        !            21:        '1462970 days',
        !            22:        
        !            23:        // around 1 leap year period in years
        !            24:        '398 years',
        !            25:        '399 years',
        !            26:        '400 years',
        !            27:        '401 years',
        !            28:        
        !            29:        // around 40000 years
        !            30:        '39755 years',
        !            31:        '39999 years',
        !            32:        '40000 years',
        !            33:        '40001 years',
        !            34:        '41010 years',
        !            35:        
        !            36:        // bigger than int (32-bit)
        !            37:        '10000000000 seconds',
        !            38:        '10000000000 minutes',
        !            39:        '10000000000 hours',
        !            40:        '10000000000 days',
        !            41:        '10000000000 months',
        !            42:        '10000000000 years',
        !            43: );
        !            44: 
        !            45: foreach ($offsets AS $offset) {
        !            46:        foreach (array('+', '-') AS $direction) {
        !            47:                $dt = date_create("$base_time $direction$offset");
        !            48:                echo "$direction$offset: " . date_format($dt, DATE_ISO8601) . "\n";
        !            49:        }
        !            50: }
        !            51: 
        !            52: ?>
        !            53: --EXPECT--
        !            54: +1460000 days: 6005-07-03T12:00:00+0000
        !            55: -1460000 days: -1990-10-25T12:00:00+0000
        !            56: +1460969 days: 6008-02-27T12:00:00+0000
        !            57: -1460969 days: -1992-02-29T12:00:00+0000
        !            58: +1460970 days: 6008-02-28T12:00:00+0000
        !            59: -1460970 days: -1992-02-28T12:00:00+0000
        !            60: +1460971 days: 6008-02-29T12:00:00+0000
        !            61: -1460971 days: -1992-02-27T12:00:00+0000
        !            62: +1462970 days: 6013-08-20T12:00:00+0000
        !            63: -1462970 days: -1998-09-07T12:00:00+0000
        !            64: +398 years: 2406-02-28T12:00:00+0000
        !            65: -398 years: 1610-02-28T12:00:00+0000
        !            66: +399 years: 2407-02-28T12:00:00+0000
        !            67: -399 years: 1609-02-28T12:00:00+0000
        !            68: +400 years: 2408-02-28T12:00:00+0000
        !            69: -400 years: 1608-02-28T12:00:00+0000
        !            70: +401 years: 2409-02-28T12:00:00+0000
        !            71: -401 years: 1607-02-28T12:00:00+0000
        !            72: +39755 years: 41763-02-28T12:00:00+0000
        !            73: -39755 years: -37747-02-28T12:00:00+0000
        !            74: +39999 years: 42007-02-28T12:00:00+0000
        !            75: -39999 years: -37991-02-28T12:00:00+0000
        !            76: +40000 years: 42008-02-28T12:00:00+0000
        !            77: -40000 years: -37992-02-28T12:00:00+0000
        !            78: +40001 years: 42009-02-28T12:00:00+0000
        !            79: -40001 years: -37993-02-28T12:00:00+0000
        !            80: +41010 years: 43018-02-28T12:00:00+0000
        !            81: -41010 years: -39002-02-28T12:00:00+0000
        !            82: +10000000000 seconds: 2325-01-18T05:46:40+0000
        !            83: -10000000000 seconds: 1691-04-09T18:13:20+0000
        !            84: +10000000000 minutes: 21021-05-27T22:40:00+0000
        !            85: -10000000000 minutes: -17006-12-01T01:20:00+0000
        !            86: +10000000000 hours: 1142802-09-30T04:00:00+0000
        !            87: -10000000000 hours: -1138787-07-28T20:00:00+0000
        !            88: +10000000000 days: 27381078-03-25T12:00:00+0000
        !            89: -10000000000 days: -27377062-02-02T12:00:00+0000
        !            90: +10000000000 months: 833335341-06-28T12:00:00+0000
        !            91: -10000000000 months: -833331326-10-28T12:00:00+0000
        !            92: +10000000000 years: 10000002008-02-28T12:00:00+0000
        !            93: -10000000000 years: -9999997992-02-28T12:00:00+0000

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>