コード例 #1
0
ファイル: TimeLibTest.php プロジェクト: Jony01/LLD
 /**
  * TimeLibTest::testTimezone()
  *
  * @return void
  */
 public function testTimezone()
 {
     $timezone = TimeLib::timezone();
     // usually UTC
     $name = $timezone->getName();
     $this->debug($name);
     $this->assertTrue(!empty($name));
     $location = $timezone->getLocation();
     $this->debug($location);
     $this->assertTrue(!empty($location['country_code']));
     $this->assertTrue(isset($location['latitude']));
     $this->assertTrue(isset($location['longitude']));
     $offset = $timezone->getOffset(new DateTime('@' . mktime(0, 0, 0, 1, 1, date('Y'))));
     $this->debug($offset);
     $phpTimezone = date_default_timezone_get();
     $this->assertEquals($name, $phpTimezone);
 }