当前位置: 首页>>代码示例>>PHP>>正文


PHP CakeTime::listTimezones方法代码示例

本文整理汇总了PHP中CakeTime::listTimezones方法的典型用法代码示例。如果您正苦于以下问题:PHP CakeTime::listTimezones方法的具体用法?PHP CakeTime::listTimezones怎么用?PHP CakeTime::listTimezones使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CakeTime的用法示例。


在下文中一共展示了CakeTime::listTimezones方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testListTimezones

 /**
  * testListTimezones
  *
  * @return void
  */
 public function testListTimezones()
 {
     $return = CakeTime::listTimezones();
     $this->assertTrue(isset($return['Asia']['Asia/Bangkok']));
     $this->assertEquals('Bangkok', $return['Asia']['Asia/Bangkok']);
     $this->assertTrue(isset($return['America']['America/Argentina/Buenos_Aires']));
     $this->assertEquals('Argentina/Buenos_Aires', $return['America']['America/Argentina/Buenos_Aires']);
     $this->assertTrue(isset($return['UTC']['UTC']));
     $this->assertFalse(isset($return['Cuba']));
     $this->assertFalse(isset($return['US']));
     $return = CakeTime::listTimezones('#^Asia/#');
     $this->assertTrue(isset($return['Asia']['Asia/Bangkok']));
     $this->assertFalse(isset($return['Pacific']));
     $return = CakeTime::listTimezones('#^(America|Pacific)/#', null, false);
     $this->assertTrue(isset($return['America/Argentina/Buenos_Aires']));
     $this->assertTrue(isset($return['Pacific/Tahiti']));
     if (!$this->skipIf(version_compare(PHP_VERSION, '5.3.0', '<'))) {
         $return = CakeTime::listTimezones(DateTimeZone::ASIA);
         $this->assertTrue(isset($return['Asia']['Asia/Bangkok']));
         $this->assertFalse(isset($return['Pacific']));
         $return = CakeTime::listTimezones(DateTimeZone::PER_COUNTRY, 'US', false);
         $this->assertTrue(isset($return['Pacific/Honolulu']));
         $this->assertFalse(isset($return['Asia/Bangkok']));
     }
 }
开发者ID:terriblyuncreative,项目名称:moviedb,代码行数:30,代码来源:CakeTimeTest.php

示例2: testListTimezones

 /**
  * testListTimezones
  *
  * @return void
  */
 public function testListTimezones()
 {
     $this->skipIf(version_compare(PHP_VERSION, '5.4.0', '<='), 'This test requires newer libicu which is in php5.4+');
     $return = CakeTime::listTimezones();
     $this->assertTrue(isset($return['Asia']['Asia/Bangkok']));
     $this->assertEquals('Bangkok', $return['Asia']['Asia/Bangkok']);
     $this->assertTrue(isset($return['America']['America/Argentina/Buenos_Aires']));
     $this->assertEquals('Argentina/Buenos_Aires', $return['America']['America/Argentina/Buenos_Aires']);
     $this->assertTrue(isset($return['UTC']['UTC']));
     $this->assertFalse(isset($return['Cuba']));
     $this->assertFalse(isset($return['US']));
     $return = CakeTime::listTimezones('#^Asia/#');
     $this->assertTrue(isset($return['Asia']['Asia/Bangkok']));
     $this->assertFalse(isset($return['Pacific']));
     $return = CakeTime::listTimezones(null, null, array('abbr' => true));
     $this->assertTrue(isset($return['Asia']['Asia/Jakarta']));
     $this->assertEquals('Jakarta - WIB', $return['Asia']['Asia/Jakarta']);
     $this->assertEquals('Regina - CST', $return['America']['America/Regina']);
     $return = CakeTime::listTimezones(null, null, array('abbr' => true, 'before' => ' (', 'after' => ')'));
     $this->assertEquals('Jayapura (WIT)', $return['Asia']['Asia/Jayapura']);
     $this->assertEquals('Regina (CST)', $return['America']['America/Regina']);
     $return = CakeTime::listTimezones('#^(America|Pacific)/#', null, false);
     $this->assertTrue(isset($return['America/Argentina/Buenos_Aires']));
     $this->assertTrue(isset($return['Pacific/Tahiti']));
     if (!$this->skipIf(version_compare(PHP_VERSION, '5.3.0', '<'))) {
         $return = CakeTime::listTimezones(DateTimeZone::ASIA);
         $this->assertTrue(isset($return['Asia']['Asia/Bangkok']));
         $this->assertFalse(isset($return['Pacific']));
         $return = CakeTime::listTimezones(DateTimeZone::PER_COUNTRY, 'US', false);
         $this->assertTrue(isset($return['Pacific/Honolulu']));
         $this->assertFalse(isset($return['Asia/Bangkok']));
     }
 }
开发者ID:stuchalk,项目名称:OSDB,代码行数:38,代码来源:CakeTimeTest.php


注:本文中的CakeTime::listTimezones方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。