Passed
Pull Request — master (#4276)
by Owen
13:56
created

XorTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 9
dl 0
loc 24
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A providerXOR() 0 3 1
A providerXORLiteral() 0 3 1
A testXOR() 0 4 1
A testXORLiteral() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Logical;
6
7
class XorTest extends AllSetupTeardown
8
{
9
    #[\PHPUnit\Framework\Attributes\DataProvider('providerXOR')]
10
    public function testXOR(mixed $expectedResult, mixed ...$args): void
11
    {
12
        $this->runTestCase('XOR', $expectedResult, ...$args);
13
    }
14
15
    public static function providerXOR(): array
16
    {
17
        return require 'tests/data/Calculation/Logical/XOR.php';
18
    }
19
20
    #[\PHPUnit\Framework\Attributes\DataProvider('providerXORLiteral')]
21
    public function testXORLiteral(mixed $expectedResult, float|string $formula): void
22
    {
23
        $sheet = $this->getSheet();
24
        $sheet->getCell('A1')->setValue("=XOR($formula)");
25
        self::assertSame($expectedResult, $sheet->getCell('A1')->getCalculatedValue());
26
    }
27
28
    public static function providerXORLiteral(): array
29
    {
30
        return require 'tests/data/Calculation/Logical/XORLiteral.php';
31
    }
32
}
33