PhpSpreadsheet/unitTests/Classes/src/CalculationTest.php
2015-05-30 12:25:17 +01:00

33 lines
1.2 KiB
PHP

<?php
namespace PHPExcel;
require_once 'testDataFileIterator.php';
class CalculationTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
Calculation\Functions::setCompatibilityMode(Calculation\Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerBinaryComparisonOperation
*/
public function testBinaryComparisonOperation($formula, $expectedResultExcel, $expectedResultOpenOffice)
{
Calculation\Functions::setCompatibilityMode(Calculation\Functions::COMPATIBILITY_EXCEL);
$resultExcel = Calculation::getInstance()->_calculateFormulaValue($formula);
$this->assertEquals($expectedResultExcel, $resultExcel, 'should be Excel compatible');
Calculation\Functions::setCompatibilityMode(Calculation\Functions::COMPATIBILITY_OPENOFFICE);
$resultOpenOffice = Calculation::getInstance()->_calculateFormulaValue($formula);
$this->assertEquals($expectedResultOpenOffice, $resultOpenOffice, 'should be OpenOffice compatible');
}
public function providerBinaryComparisonOperation()
{
return new \testDataFileIterator('rawTestData/CalculationBinaryComparisonOperation.data');
}
}