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
|
2013-06-14 22:57:50 +00:00
|
|
|
*/
|
2015-05-17 13:00:02 +00:00
|
|
|
public function testHLOOKUP()
|
|
|
|
{
|
|
|
|
$args = func_get_args();
|
|
|
|
$expectedResult = array_pop($args);
|
2016-08-16 15:33:57 +00:00
|
|
|
$result = call_user_func_array([LookupRef::class, '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
|
2013-06-15 11:15:03 +00:00
|
|
|
*/
|
2015-05-17 13:00:02 +00:00
|
|
|
public function testVLOOKUP()
|
|
|
|
{
|
|
|
|
$args = func_get_args();
|
|
|
|
$expectedResult = array_pop($args);
|
2016-08-16 15:33:57 +00:00
|
|
|
$result = call_user_func_array([LookupRef::class, '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
|
|
|
}
|
2013-06-14 22:57:50 +00:00
|
|
|
}
|