TimeZoneTest.php 882 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. class TimeZoneTest extends PHPUnit_Framework_TestCase
  3. {
  4. public function setUp()
  5. {
  6. if (!defined('PHPEXCEL_ROOT')) {
  7. define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
  8. }
  9. require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
  10. }
  11. public function testSetTimezone()
  12. {
  13. $timezoneValues = array(
  14. 'Europe/Prague',
  15. 'Asia/Tokyo',
  16. 'America/Indiana/Indianapolis',
  17. 'Pacific/Honolulu',
  18. 'Atlantic/St_Helena',
  19. );
  20. foreach($timezoneValues as $timezoneValue) {
  21. $result = call_user_func(array('PHPExcel_Shared_TimeZone','setTimezone'),$timezoneValue);
  22. $this->assertTrue($result);
  23. }
  24. }
  25. public function testSetTimezoneWithInvalidValue()
  26. {
  27. $unsupportedTimezone = 'Etc/GMT+10';
  28. $result = call_user_func(array('PHPExcel_Shared_TimeZone','setTimezone'),$unsupportedTimezone);
  29. $this->assertFalse($result);
  30. }
  31. }