More refactoring Excel of Calculation Function Unit Tests
This commit is contained in:
parent
905a697639
commit
f14e5ea837
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\LookupRef;
|
||||||
|
|
||||||
|
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Calculation\LookupRef;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
class ChooseTest extends TestCase
|
||||||
|
{
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider providerCHOOSE
|
||||||
|
*
|
||||||
|
* @param mixed $expectedResult
|
||||||
|
*/
|
||||||
|
public function testCHOOSE($expectedResult, ...$args)
|
||||||
|
{
|
||||||
|
$result = LookupRef::CHOOSE(...$args);
|
||||||
|
$this->assertEquals($expectedResult, $result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function providerCHOOSE()
|
||||||
|
{
|
||||||
|
return require 'data/Calculation/LookupRef/CHOOSE.php';
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\LookupRef;
|
||||||
|
|
||||||
|
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Calculation\LookupRef;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
class ColumnsTest extends TestCase
|
||||||
|
{
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider providerCOLUMNS
|
||||||
|
*
|
||||||
|
* @param mixed $expectedResult
|
||||||
|
*/
|
||||||
|
public function testCOLUMNS($expectedResult, ...$args)
|
||||||
|
{
|
||||||
|
$result = LookupRef::COLUMNS(...$args);
|
||||||
|
$this->assertEquals($expectedResult, $result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function providerCOLUMNS()
|
||||||
|
{
|
||||||
|
return require 'data/Calculation/LookupRef/COLUMNS.php';
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\LookupRef;
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\LookupRef;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\LookupRef;
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Calculation\LookupRef;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class HLookupTest extends TestCase
|
class HLookupTest extends TestCase
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\LookupRef;
|
||||||
|
|
||||||
|
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Calculation\LookupRef;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
class IndexTest extends TestCase
|
||||||
|
{
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider providerINDEX
|
||||||
|
*
|
||||||
|
* @param mixed $expectedResult
|
||||||
|
*/
|
||||||
|
public function testINDEX($expectedResult, ...$args)
|
||||||
|
{
|
||||||
|
$result = LookupRef::INDEX(...$args);
|
||||||
|
$this->assertEquals($expectedResult, $result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function providerINDEX()
|
||||||
|
{
|
||||||
|
return require 'data/Calculation/LookupRef/INDEX.php';
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\LookupRef;
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\LookupRef;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\LookupRef;
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Calculation\LookupRef;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class LookupTest extends TestCase
|
class LookupTest extends TestCase
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\LookupRef;
|
||||||
|
|
||||||
|
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Calculation\LookupRef;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
class MatchTest extends TestCase
|
||||||
|
{
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider providerMATCH
|
||||||
|
*
|
||||||
|
* @param mixed $expectedResult
|
||||||
|
*/
|
||||||
|
public function testMATCH($expectedResult, ...$args)
|
||||||
|
{
|
||||||
|
$result = LookupRef::MATCH(...$args);
|
||||||
|
$this->assertEquals($expectedResult, $result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function providerMATCH()
|
||||||
|
{
|
||||||
|
return require 'data/Calculation/LookupRef/MATCH.php';
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\LookupRef;
|
||||||
|
|
||||||
|
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Calculation\LookupRef;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
class RowsTest extends TestCase
|
||||||
|
{
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider providerROWS
|
||||||
|
*
|
||||||
|
* @param mixed $expectedResult
|
||||||
|
*/
|
||||||
|
public function testROWS($expectedResult, ...$args)
|
||||||
|
{
|
||||||
|
$result = LookupRef::ROWS(...$args);
|
||||||
|
$this->assertEquals($expectedResult, $result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function providerROWS()
|
||||||
|
{
|
||||||
|
return require 'data/Calculation/LookupRef/ROWS.php';
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\LookupRef;
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\LookupRef;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\LookupRef;
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Calculation\LookupRef;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class VLookupTest extends TestCase
|
class VLookupTest extends TestCase
|
||||||
|
|
|
@ -19,70 +19,6 @@ class LookupRefTest extends TestCase
|
||||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @dataProvider providerMATCH
|
|
||||||
*
|
|
||||||
* @param mixed $expectedResult
|
|
||||||
*/
|
|
||||||
public function testMATCH($expectedResult, ...$args)
|
|
||||||
{
|
|
||||||
$result = LookupRef::MATCH(...$args);
|
|
||||||
self::assertEquals($expectedResult, $result);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function providerMATCH()
|
|
||||||
{
|
|
||||||
return require 'data/Calculation/LookupRef/MATCH.php';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @dataProvider providerINDEX
|
|
||||||
*
|
|
||||||
* @param mixed $expectedResult
|
|
||||||
*/
|
|
||||||
public function testINDEX($expectedResult, ...$args)
|
|
||||||
{
|
|
||||||
$result = LookupRef::INDEX(...$args);
|
|
||||||
self::assertEquals($expectedResult, $result);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function providerINDEX()
|
|
||||||
{
|
|
||||||
return require 'data/Calculation/LookupRef/INDEX.php';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @dataProvider providerCOLUMNS
|
|
||||||
*
|
|
||||||
* @param mixed $expectedResult
|
|
||||||
*/
|
|
||||||
public function testCOLUMNS($expectedResult, ...$args)
|
|
||||||
{
|
|
||||||
$result = LookupRef::COLUMNS(...$args);
|
|
||||||
self::assertEquals($expectedResult, $result);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function providerCOLUMNS()
|
|
||||||
{
|
|
||||||
return require 'data/Calculation/LookupRef/COLUMNS.php';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @dataProvider providerROWS
|
|
||||||
*
|
|
||||||
* @param mixed $expectedResult
|
|
||||||
*/
|
|
||||||
public function testROWS($expectedResult, ...$args)
|
|
||||||
{
|
|
||||||
$result = LookupRef::ROWS(...$args);
|
|
||||||
self::assertEquals($expectedResult, $result);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function providerROWS()
|
|
||||||
{
|
|
||||||
return require 'data/Calculation/LookupRef/ROWS.php';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider providerFormulaText
|
* @dataProvider providerFormulaText
|
||||||
*
|
*
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
[
|
||||||
|
"brown",
|
||||||
|
4, "red", "blue", "green", "brown",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"blue",
|
||||||
|
2, "red", "blue", "green", "brown",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"green",
|
||||||
|
3, "red", "blue", "green", "brown",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"red",
|
||||||
|
1, "red", "blue", "green", "brown",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"#VALUE!",
|
||||||
|
5, "red", "blue", "green", "brown",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"#VALUE!",
|
||||||
|
0, "red", "blue", "green", "brown",
|
||||||
|
],
|
||||||
|
];
|
Loading…
Reference in New Issue