PhpSpreadsheet/tests/PhpSpreadsheetTests/Shared/TimeZoneTest.php

33 lines
823 B
PHP
Raw Normal View History

<?php
namespace PhpOffice\PhpSpreadsheetTests\Shared;
use PhpOffice\PhpSpreadsheet\Shared\TimeZone;
use PHPUnit_Framework_TestCase;
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);
self::assertTrue($result);
2015-05-17 13:00:02 +00:00
}
}
public function testSetTimezoneWithInvalidValue()
2015-05-17 13:00:02 +00:00
{
$unsupportedTimezone = 'Etc/GMT+10';
$result = TimeZone::setTimezone($unsupportedTimezone);
self::assertFalse($result);
2015-05-17 13:00:02 +00:00
}
}