2013-11-20 09:55:05 +00:00
|
|
|
<?php
|
|
|
|
|
2015-05-29 20:35:35 +00:00
|
|
|
namespace PHPExcel;
|
|
|
|
|
|
|
|
class CalculationTest extends \PHPUnit_Framework_TestCase
|
2013-11-20 09:55:05 +00:00
|
|
|
{
|
|
|
|
public function setUp()
|
|
|
|
{
|
2015-05-29 20:35:35 +00:00
|
|
|
Calculation\Functions::setCompatibilityMode(Calculation\Functions::COMPATIBILITY_EXCEL);
|
2013-11-20 09:55:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerBinaryComparisonOperation
|
|
|
|
*/
|
|
|
|
public function testBinaryComparisonOperation($formula, $expectedResultExcel, $expectedResultOpenOffice)
|
|
|
|
{
|
2015-05-29 20:35:35 +00:00
|
|
|
Calculation\Functions::setCompatibilityMode(Calculation\Functions::COMPATIBILITY_EXCEL);
|
|
|
|
$resultExcel = Calculation::getInstance()->_calculateFormulaValue($formula);
|
2013-11-20 09:55:05 +00:00
|
|
|
$this->assertEquals($expectedResultExcel, $resultExcel, 'should be Excel compatible');
|
|
|
|
|
2015-05-29 20:35:35 +00:00
|
|
|
Calculation\Functions::setCompatibilityMode(Calculation\Functions::COMPATIBILITY_OPENOFFICE);
|
|
|
|
$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-13 17:22:11 +00:00
|
|
|
return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/CalculationBinaryComparisonOperation.data');
|
2013-11-20 09:55:05 +00:00
|
|
|
}
|
|
|
|
}
|