Completed
Push — develop ( 268fc1...a06731 )
by Adrien
23:59
created

CalculationTest::testGetFunctions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 3
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace PhpOffice\PhpSpreadsheetTests;
4
5
use PhpOffice\PhpSpreadsheet\Calculation;
6
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
7
8
class CalculationTest extends \PHPUnit_Framework_TestCase
9
{
10
    public function setUp()
11
    {
12
        Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
13
    }
14
15
    /**
16
     * @dataProvider providerBinaryComparisonOperation
17
     */
18
    public function testBinaryComparisonOperation($formula, $expectedResultExcel, $expectedResultOpenOffice)
19
    {
20
        Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
21
        $resultExcel = Calculation::getInstance()->_calculateFormulaValue($formula);
22
        $this->assertEquals($expectedResultExcel, $resultExcel, 'should be Excel compatible');
23
24
        Functions::setCompatibilityMode(Functions::COMPATIBILITY_OPENOFFICE);
25
        $resultOpenOffice = Calculation::getInstance()->_calculateFormulaValue($formula);
26
        $this->assertEquals($expectedResultOpenOffice, $resultOpenOffice, 'should be OpenOffice compatible');
27
    }
28
29
    public function providerBinaryComparisonOperation()
30
    {
31
        return require 'data/CalculationBinaryComparisonOperation.php';
32
    }
33
34
    /**
35
     * @dataProvider providerGetFunctions
36
     */
37
    public function testGetFunctions($category, $functionCall, $argumentCount)
0 ignored issues
show
Unused Code introduced by
The parameter $category is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $argumentCount is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
38
    {
39
        $this->assertTrue(is_callable($functionCall));
40
    }
41
42
    public function providerGetFunctions()
43
    {
44
        return Calculation::getInstance()->getFunctions();
45
    }
46
}
47