PhpSpreadsheet/tests/PhpSpreadsheetTests/Shared/TimeZoneTest.php
Adrien Crivelli aef4d711f5
Use self::assert*() instead of $this->assert*()
Because even if it doesn't make a difference in practice, it is
technically more correct to call static methods statically. It
also better advertise that those methods can be used from any context.
2017-09-22 14:22:44 +09:00

33 lines
823 B
PHP

<?php
namespace PhpOffice\PhpSpreadsheetTests\Shared;
use PhpOffice\PhpSpreadsheet\Shared\TimeZone;
use PHPUnit_Framework_TestCase;
class TimeZoneTest extends PHPUnit_Framework_TestCase
{
public function testSetTimezone()
{
$timezoneValues = [
'Europe/Prague',
'Asia/Tokyo',
'America/Indiana/Indianapolis',
'Pacific/Honolulu',
'Atlantic/St_Helena',
];
foreach ($timezoneValues as $timezoneValue) {
$result = TimeZone::setTimezone($timezoneValue);
self::assertTrue($result);
}
}
public function testSetTimezoneWithInvalidValue()
{
$unsupportedTimezone = 'Etc/GMT+10';
$result = TimeZone::setTimezone($unsupportedTimezone);
self::assertFalse($result);
}
}