| 
									
										
										
										
											2012-11-03 21:52:55 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-31 17:18:12 +00:00
										 |  |  | namespace PhpOffice\PhpSpreadsheetTests\Shared; | 
					
						
							| 
									
										
										
										
											2012-11-03 21:52:55 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-31 17:18:12 +00:00
										 |  |  | use PhpOffice\PhpSpreadsheet\Shared\TimeZone; | 
					
						
							| 
									
										
										
										
											2017-05-17 22:02:17 +00:00
										 |  |  | use PHPUnit_Framework_TestCase; | 
					
						
							| 
									
										
										
										
											2016-08-14 04:08:43 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-17 22:02:17 +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
										 |  |  | } |