2013-06-14 22:57:50 +00:00
|
|
|
<?php
|
|
|
|
|
2016-08-31 17:18:12 +00:00
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation;
|
2013-06-14 22:57:50 +00:00
|
|
|
|
2016-08-31 17:18:12 +00:00
|
|
|
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|
|
|
use PhpOffice\PhpSpreadsheet\Calculation\LookupRef;
|
2016-08-14 04:08:43 +00:00
|
|
|
|
2016-05-20 06:41:09 +00:00
|
|
|
/**
|
2016-12-22 14:43:37 +00:00
|
|
|
* Class LookupRefTest.
|
2016-05-20 06:41:09 +00:00
|
|
|
*/
|
2016-03-22 14:35:50 +00:00
|
|
|
class LookupRefTest extends \PHPUnit_Framework_TestCase
|
2013-06-14 22:57:50 +00:00
|
|
|
{
|
|
|
|
public function setUp()
|
|
|
|
{
|
2016-08-14 04:08:43 +00:00
|
|
|
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2013-06-14 22:57:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerHLOOKUP
|
2016-05-19 10:31:40 +00:00
|
|
|
* @group fail19
|
2017-01-23 05:49:10 +00:00
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
2013-06-14 22:57:50 +00:00
|
|
|
*/
|
2017-01-23 05:49:10 +00:00
|
|
|
public function testHLOOKUP($expectedResult, ...$args)
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2017-01-23 05:49:10 +00:00
|
|
|
$result = LookupRef::HLOOKUP(...$args);
|
2015-05-17 13:00:02 +00:00
|
|
|
$this->assertEquals($expectedResult, $result);
|
|
|
|
}
|
2013-06-14 22:57:50 +00:00
|
|
|
|
|
|
|
public function providerHLOOKUP()
|
|
|
|
{
|
2016-08-16 12:00:19 +00:00
|
|
|
return require 'data/Calculation/LookupRef/HLOOKUP.php';
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2013-06-14 22:57:50 +00:00
|
|
|
|
2013-06-15 11:15:03 +00:00
|
|
|
/**
|
|
|
|
* @dataProvider providerVLOOKUP
|
2016-05-19 10:31:40 +00:00
|
|
|
* @group fail19
|
2017-01-23 05:49:10 +00:00
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
2013-06-15 11:15:03 +00:00
|
|
|
*/
|
2017-01-23 05:49:10 +00:00
|
|
|
public function testVLOOKUP($expectedResult, ...$args)
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2017-01-23 05:49:10 +00:00
|
|
|
$result = LookupRef::VLOOKUP(...$args);
|
2015-05-17 13:00:02 +00:00
|
|
|
$this->assertEquals($expectedResult, $result);
|
|
|
|
}
|
2013-06-15 11:15:03 +00:00
|
|
|
|
|
|
|
public function providerVLOOKUP()
|
|
|
|
{
|
2016-08-16 12:00:19 +00:00
|
|
|
return require 'data/Calculation/LookupRef/VLOOKUP.php';
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2017-04-01 03:36:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerMATCH
|
|
|
|
* @group fail19
|
|
|
|
*
|
|
|
|
* @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';
|
|
|
|
}
|
2013-06-14 22:57:50 +00:00
|
|
|
}
|