|
@@ 77-87 (lines=11) @@
|
| 74 |
|
$this->assertSame('America/Toronto', $c->getTimezoneName()); |
| 75 |
|
} |
| 76 |
|
|
| 77 |
|
public function testSettingTimezone() |
| 78 |
|
{ |
| 79 |
|
$timezone = 'Europe/London'; |
| 80 |
|
$dtz = new \DateTimeZone($timezone); |
| 81 |
|
$dt = new \DateTime('now', $dtz); |
| 82 |
|
$dayLightSavingTimeOffset = (int) $dt->format('I'); |
| 83 |
|
|
| 84 |
|
$c = new Date('now', $dtz); |
| 85 |
|
$this->assertSame($timezone, $c->getTimezoneName()); |
| 86 |
|
$this->assertSame($dayLightSavingTimeOffset, $c->getOffsetHours()); |
| 87 |
|
} |
| 88 |
|
|
| 89 |
|
public function testParseSettingTimezone() |
| 90 |
|
{ |
|
@@ 89-99 (lines=11) @@
|
| 86 |
|
$this->assertSame($dayLightSavingTimeOffset, $c->getOffsetHours()); |
| 87 |
|
} |
| 88 |
|
|
| 89 |
|
public function testParseSettingTimezone() |
| 90 |
|
{ |
| 91 |
|
$timezone = 'Europe/London'; |
| 92 |
|
$dtz = new \DateTimeZone($timezone); |
| 93 |
|
$dt = new \DateTime('now', $dtz); |
| 94 |
|
$dayLightSavingTimeOffset = (int) $dt->format('I'); |
| 95 |
|
|
| 96 |
|
$c = Date::parse('now', $dtz); |
| 97 |
|
$this->assertSame($timezone, $c->getTimezoneName()); |
| 98 |
|
$this->assertSame($dayLightSavingTimeOffset, $c->getOffsetHours()); |
| 99 |
|
} |
| 100 |
|
|
| 101 |
|
public function testSettingTimezoneWithString() |
| 102 |
|
{ |
|
@@ 101-111 (lines=11) @@
|
| 98 |
|
$this->assertSame($dayLightSavingTimeOffset, $c->getOffsetHours()); |
| 99 |
|
} |
| 100 |
|
|
| 101 |
|
public function testSettingTimezoneWithString() |
| 102 |
|
{ |
| 103 |
|
$timezone = 'Asia/Tokyo'; |
| 104 |
|
$dtz = new \DateTimeZone($timezone); |
| 105 |
|
$dt = new \DateTime('now', $dtz); |
| 106 |
|
$dayLightSavingTimeOffset = (int) $dt->format('I'); |
| 107 |
|
|
| 108 |
|
$c = new Date('now', $timezone); |
| 109 |
|
$this->assertSame($timezone, $c->getTimezoneName()); |
| 110 |
|
$this->assertSame(9 + $dayLightSavingTimeOffset, $c->getOffsetHours()); |
| 111 |
|
} |
| 112 |
|
|
| 113 |
|
public function testParseSettingTimezoneWithString() |
| 114 |
|
{ |
|
@@ 113-123 (lines=11) @@
|
| 110 |
|
$this->assertSame(9 + $dayLightSavingTimeOffset, $c->getOffsetHours()); |
| 111 |
|
} |
| 112 |
|
|
| 113 |
|
public function testParseSettingTimezoneWithString() |
| 114 |
|
{ |
| 115 |
|
$timezone = 'Asia/Tokyo'; |
| 116 |
|
$dtz = new \DateTimeZone($timezone); |
| 117 |
|
$dt = new \DateTime('now', $dtz); |
| 118 |
|
$dayLightSavingTimeOffset = (int) $dt->format('I'); |
| 119 |
|
|
| 120 |
|
$c = Date::parse('now', $timezone); |
| 121 |
|
$this->assertSame($timezone, $c->getTimezoneName()); |
| 122 |
|
$this->assertSame(9 + $dayLightSavingTimeOffset, $c->getOffsetHours()); |
| 123 |
|
} |
| 124 |
|
} |
| 125 |
|
|