2012-11-03 21:52:55 +00:00
|
|
|
<?php
|
|
|
|
|
2016-08-25 04:53:15 +00:00
|
|
|
namespace PhpSpreadsheetTests\Shared;
|
2012-11-03 21:52:55 +00:00
|
|
|
|
2016-08-16 14:24:47 +00:00
|
|
|
use PhpSpreadsheet\Shared\TimeZone;
|
2016-08-14 04:08:43 +00:00
|
|
|
|
2016-03-22 14:35:50 +00:00
|
|
|
class TimeZoneTest extends \PHPUnit_Framework_TestCase
|
2012-11-03 21:52:55 +00:00
|
|
|
{
|
2015-05-17 13:00:02 +00:00
|
|
|
public function testSetTimezone()
|
|
|
|
{
|
2016-08-16 15:33:57 +00:00
|
|
|
$timezoneValues = [
|
2015-05-17 13:00:02 +00:00
|
|
|
'Europe/Prague',
|
|
|
|
'Asia/Tokyo',
|
|
|
|
'America/Indiana/Indianapolis',
|
|
|
|
'Pacific/Honolulu',
|
|
|
|
'Atlantic/St_Helena',
|
2016-08-16 15:33:57 +00:00
|
|
|
];
|
2015-05-17 13:00:02 +00:00
|
|
|
|
|
|
|
foreach ($timezoneValues as $timezoneValue) {
|
2016-08-26 06:39:29 +00:00
|
|
|
$result = TimeZone::setTimezone($timezoneValue);
|
2015-05-17 13:00:02 +00:00
|
|
|
$this->assertTrue($result);
|
|
|
|
}
|
|
|
|
}
|
2012-11-03 21:52:55 +00:00
|
|
|
|
|
|
|
public function testSetTimezoneWithInvalidValue()
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
|
|
|
$unsupportedTimezone = 'Etc/GMT+10';
|
2016-08-26 06:39:29 +00:00
|
|
|
$result = TimeZone::setTimezone($unsupportedTimezone);
|
2015-05-17 13:00:02 +00:00
|
|
|
$this->assertFalse($result);
|
|
|
|
}
|
2012-11-03 21:52:55 +00:00
|
|
|
}
|