1<?php 2 3/* 4 * This file is part of Twig. 5 * 6 * (c) Fabien Potencier 7 * 8 * For the full copyright and license information, please view the LICENSE 9 * file that was distributed with this source code. 10 */ 11 12class Twig_Tests_Extension_IntlTest extends \PHPUnit\Framework\TestCase 13{ 14 /** 15 * @requires extension intl 16 * @requires PHP 5.5 17 */ 18 public function testLocalizedDateFilterWithDateTimeZone() 19 { 20 class_exists('Twig_Extensions_Extension_Intl'); 21 $env = $this->getMockBuilder('Twig_Environment')->disableOriginalConstructor()->getMock(); 22 $date = twig_localized_date_filter($env, new DateTime('2015-01-01T00:00:00', new DateTimeZone('UTC')), 'short', 'long', 'en', '+01:00'); 23 $this->assertEquals('1/1/15 1:00:00 AM GMT+01:00', $date); 24 } 25 26 /** 27 * @requires extension intl 28 * @requires PHP 5.5 29 */ 30 public function testLocalizedDateFilterWithDateTimeZoneZ() 31 { 32 class_exists('Twig_Extensions_Extension_Intl'); 33 $env = $this->getMockBuilder('Twig_Environment')->disableOriginalConstructor()->getMock(); 34 $date = twig_localized_date_filter($env, new DateTime('2017-11-19T00:00:00Z'), 'short', 'long', 'fr', 'Z'); 35 $this->assertEquals('19/11/2017 00:00:00 UTC', $date); 36 } 37} 38