コード例 #1
0
ファイル: CTimeTest.php プロジェクト: nunodotferreira/Phred
 public function testComponentsInTimeZone()
 {
     $time = CTime::fromString("2009-02-13 23:31:30 Europe/Helsinki");
     $year;
     $month;
     $day;
     $hour;
     $minute;
     $second;
     $millisecond;
     $dayOfWeek;
     $time->componentsInTimeZone(new CTimeZone("Europe/Helsinki"), $year, $month, $day, $hour, $minute, $second, $millisecond, $dayOfWeek);
     $this->assertTrue($year == 2009 && $month == 2 && $day == 13 && $hour == 23 && $minute == 31 && $second == 30 && $millisecond == 0 && $dayOfWeek == CTime::FRIDAY);
     $time = new CTime(0);
     $year;
     $month;
     $day;
     $hour;
     $minute;
     $second;
     $millisecond;
     $dayOfWeek;
     $time->componentsInTimeZone(new CTimeZone("Europe/Helsinki"), $year, $month, $day, $hour, $minute, $second, $millisecond, $dayOfWeek);
     $this->assertTrue($year == 1970 && $month == 1 && $day == 1 && $hour == 2 && $minute == 0 && $second == 0 && $millisecond == 0 && $dayOfWeek == CTime::THURSDAY);
     $time = CTime::fromFTime(-1234567890.25);
     $year;
     $month;
     $day;
     $hour;
     $minute;
     $second;
     $millisecond;
     $dayOfWeek;
     $time->componentsInTimeZone(new CTimeZone("Europe/Helsinki"), $year, $month, $day, $hour, $minute, $second, $millisecond, $dayOfWeek);
     $this->assertTrue($year == 1930 && $month == 11 && $day == 18 && $hour == 2 && $minute == 28 && $second == 29 && $millisecond == 750 && $dayOfWeek == CTime::TUESDAY);
 }