]> git.immae.eu Git - github/wallabag/wallabag.git/blob - vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date.test
a4c97167d3cfb8d70a07e2fb73044d2a7b1f121f
[github/wallabag/wallabag.git] / vendor / twig / twig / test / Twig / Tests / Fixtures / functions / date.test
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--
12 date_default_timezone_set('UTC');
13 return 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--
21 OK
22 OK
23 OK
24 OK
25 OK
26 OK
27 OK