]> git.immae.eu Git - github/wallabag/wallabag.git/blame - vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date.test
gitignore vendor
[github/wallabag/wallabag.git] / vendor / twig / twig / test / Twig / Tests / Fixtures / functions / date.test
CommitLineData
4f5b44bd
NL
1--TEST--
2"date" function
3--TEMPLATE--
4{{ date() == date('now') ? 'OK' : 'KO' }}
5{{ date() > date('-1day') ? 'OK' : 'KO' }}
6{{ date(date1) == date('2010-10-04 13:45') ? 'OK' : 'KO' }}
7{{ date(date2) == date('2010-10-04 13:45') ? 'OK' : 'KO' }}
8{{ date(date3) == date('2010-10-04 13:45') ? 'OK' : 'KO' }}
9{{ date(date4) == date('2010-10-04 13:45') ? 'OK' : 'KO' }}
10{{ date(date5) == date('1964-01-02 03:04') ? 'OK' : 'KO' }}
11--DATA--
12date_default_timezone_set('UTC');
13return array(
14 'date1' => mktime(13, 45, 0, 10, 4, 2010),
15 'date2' => new DateTime('2010-10-04 13:45'),
16 'date3' => '2010-10-04 13:45',
17 'date4' => 1286199900, // DateTime::createFromFormat('Y-m-d H:i', '2010-10-04 13:45', new DateTimeZone('UTC'))->getTimestamp() -- A unixtimestamp is always GMT
18 'date5' => -189291360, // DateTime::createFromFormat('Y-m-d H:i', '1964-01-02 03:04', new DateTimeZone('UTC'))->getTimestamp(),
19)
20--EXPECT--
21OK
22OK
23OK
24OK
25OK
26OK
27OK