| 
									
										
										
										
											2013-11-20 09:55:05 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-31 17:18:12 +00:00
										 |  |  | namespace PhpOffice\PhpSpreadsheetTests; | 
					
						
							| 
									
										
										
										
											2016-08-14 04:08:43 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-31 17:18:12 +00:00
										 |  |  | use PhpOffice\PhpSpreadsheet\Calculation; | 
					
						
							|  |  |  | use PhpOffice\PhpSpreadsheet\Calculation\Functions; | 
					
						
							| 
									
										
										
										
											2015-05-29 20:35:35 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | class CalculationTest extends \PHPUnit_Framework_TestCase | 
					
						
							| 
									
										
										
										
											2013-11-20 09:55:05 +00:00
										 |  |  | { | 
					
						
							|  |  |  |     public function setUp() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-08-14 04:08:43 +00:00
										 |  |  |         Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); | 
					
						
							| 
									
										
										
										
											2013-11-20 09:55:05 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * @dataProvider providerBinaryComparisonOperation | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function testBinaryComparisonOperation($formula, $expectedResultExcel, $expectedResultOpenOffice) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-08-14 04:08:43 +00:00
										 |  |  |         Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); | 
					
						
							| 
									
										
										
										
											2015-05-29 20:35:35 +00:00
										 |  |  |         $resultExcel = Calculation::getInstance()->_calculateFormulaValue($formula); | 
					
						
							| 
									
										
										
										
											2013-11-20 09:55:05 +00:00
										 |  |  |         $this->assertEquals($expectedResultExcel, $resultExcel, 'should be Excel compatible'); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-14 04:08:43 +00:00
										 |  |  |         Functions::setCompatibilityMode(Functions::COMPATIBILITY_OPENOFFICE); | 
					
						
							| 
									
										
										
										
											2015-05-29 20:35:35 +00:00
										 |  |  |         $resultOpenOffice = Calculation::getInstance()->_calculateFormulaValue($formula); | 
					
						
							| 
									
										
										
										
											2013-11-20 09:55:05 +00:00
										 |  |  |         $this->assertEquals($expectedResultOpenOffice, $resultOpenOffice, 'should be OpenOffice compatible'); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     public function providerBinaryComparisonOperation() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-08-16 12:00:19 +00:00
										 |  |  |         return require 'data/CalculationBinaryComparisonOperation.php'; | 
					
						
							| 
									
										
										
										
											2013-11-20 09:55:05 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | } |