| 
									
										
										
										
											2013-05-21 17:00:57 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-31 17:18:12 +00:00
										 |  |  | namespace PhpOffice\PhpSpreadsheetTests\Style; | 
					
						
							| 
									
										
										
										
											2013-05-21 17:00:57 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-31 17:18:12 +00:00
										 |  |  | use PhpOffice\PhpSpreadsheet\Shared\StringHelper; | 
					
						
							|  |  |  | use PhpOffice\PhpSpreadsheet\Style\NumberFormat; | 
					
						
							| 
									
										
										
										
											2017-11-08 15:48:01 +00:00
										 |  |  | use PHPUnit\Framework\TestCase; | 
					
						
							| 
									
										
										
										
											2016-08-14 04:55:34 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-08 15:48:01 +00:00
										 |  |  | class NumberFormatTest extends TestCase | 
					
						
							| 
									
										
										
										
											2013-05-21 17:00:57 +00:00
										 |  |  | { | 
					
						
							|  |  |  |     public function setUp() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-08-14 04:08:43 +00:00
										 |  |  |         StringHelper::setDecimalSeparator('.'); | 
					
						
							|  |  |  |         StringHelper::setThousandsSeparator(','); | 
					
						
							| 
									
										
										
										
											2015-05-17 13:00:02 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2013-05-21 17:00:57 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * @dataProvider providerNumberFormat | 
					
						
							| 
									
										
										
										
											2017-01-23 05:49:10 +00:00
										 |  |  |      * | 
					
						
							|  |  |  |      * @param mixed $expectedResult | 
					
						
							| 
									
										
										
										
											2013-05-21 17:00:57 +00:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2017-01-23 05:49:10 +00:00
										 |  |  |     public function testFormatValueWithMask($expectedResult, ...$args) | 
					
						
							| 
									
										
										
										
											2015-05-17 13:00:02 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2017-01-23 05:49:10 +00:00
										 |  |  |         $result = NumberFormat::toFormattedString(...$args); | 
					
						
							| 
									
										
										
										
											2017-09-20 05:55:42 +00:00
										 |  |  |         self::assertEquals($expectedResult, $result); | 
					
						
							| 
									
										
										
										
											2015-05-17 13:00:02 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2013-05-21 17:00:57 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     public function providerNumberFormat() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-08-16 12:00:19 +00:00
										 |  |  |         return require 'data/Style/NumberFormat.php'; | 
					
						
							| 
									
										
										
										
											2015-05-17 13:00:02 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2017-11-03 03:47:19 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * @dataProvider providerNumberFormatDates | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param mixed $expectedResult | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function testFormatValueWithMaskDate($expectedResult, ...$args) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         $result = NumberFormat::toFormattedString(...$args); | 
					
						
							|  |  |  |         self::assertEquals($expectedResult, $result); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     public function providerNumberFormatDates() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return require 'data/Style/NumberFormatDates.php'; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2013-05-21 17:00:57 +00:00
										 |  |  | } |