34 lines
1.1 KiB
PHP
34 lines
1.1 KiB
PHP
|
<?php
|
||
|
|
||
|
namespace PhpSpreadsheetTests;
|
||
|
|
||
|
use PhpSpreadsheet\Calculation;
|
||
|
use PhpSpreadsheet\Calculation\Functions;
|
||
|
|
||
|
class CalculationTest extends \PHPUnit_Framework_TestCase
|
||
|
{
|
||
|
public function setUp()
|
||
|
{
|
||
|
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @dataProvider providerBinaryComparisonOperation
|
||
|
*/
|
||
|
public function testBinaryComparisonOperation($formula, $expectedResultExcel, $expectedResultOpenOffice)
|
||
|
{
|
||
|
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
||
|
$resultExcel = Calculation::getInstance()->_calculateFormulaValue($formula);
|
||
|
$this->assertEquals($expectedResultExcel, $resultExcel, 'should be Excel compatible');
|
||
|
|
||
|
Functions::setCompatibilityMode(Functions::COMPATIBILITY_OPENOFFICE);
|
||
|
$resultOpenOffice = Calculation::getInstance()->_calculateFormulaValue($formula);
|
||
|
$this->assertEquals($expectedResultOpenOffice, $resultOpenOffice, 'should be OpenOffice compatible');
|
||
|
}
|
||
|
|
||
|
public function providerBinaryComparisonOperation()
|
||
|
{
|
||
|
return require 'data/CalculationBinaryComparisonOperation.php';
|
||
|
}
|
||
|
}
|