PhpSpreadsheet/tests/PhpSpreadsheetTests/Shared/TimeZoneTest.php

32 lines
794 B
PHP
Raw Normal View History

<?php
namespace PhpOffice\PhpSpreadsheetTests\Shared;
use PhpOffice\PhpSpreadsheet\Shared\TimeZone;
2016-03-22 14:35:50 +00:00
class TimeZoneTest extends \PHPUnit_Framework_TestCase
{
2015-05-17 13:00:02 +00:00
public function testSetTimezone()
{
$timezoneValues = [
2015-05-17 13:00:02 +00:00
'Europe/Prague',
'Asia/Tokyo',
'America/Indiana/Indianapolis',
'Pacific/Honolulu',
'Atlantic/St_Helena',
];
2015-05-17 13:00:02 +00:00
foreach ($timezoneValues as $timezoneValue) {
$result = TimeZone::setTimezone($timezoneValue);
2015-05-17 13:00:02 +00:00
$this->assertTrue($result);
}
}
public function testSetTimezoneWithInvalidValue()
2015-05-17 13:00:02 +00:00
{
$unsupportedTimezone = 'Etc/GMT+10';
$result = TimeZone::setTimezone($unsupportedTimezone);
2015-05-17 13:00:02 +00:00
$this->assertFalse($result);
}
}