for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace PhpOffice\PhpSpreadsheetTests;
use PhpOffice\PhpSpreadsheet\Calculation;
use PhpOffice\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)
$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';
* @dataProvider providerGetFunctions
public function testGetFunctions($category, $functionCall, $argumentCount)
$category
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
$argumentCount
$this->assertTrue(is_callable($functionCall));
public function providerGetFunctions()
return Calculation::getInstance()->getFunctions();
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.