LookupRefTest.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. require_once 'testDataFileIterator.php';
  3. class LookupRefTest extends PHPUnit_Framework_TestCase
  4. {
  5. public function setUp()
  6. {
  7. if (!defined('PHPEXCEL_ROOT')) {
  8. define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
  9. }
  10. require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
  11. PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL);
  12. }
  13. /**
  14. * @dataProvider providerHLOOKUP
  15. */
  16. public function testHLOOKUP()
  17. {
  18. $args = func_get_args();
  19. $expectedResult = array_pop($args);
  20. $result = call_user_func_array(array('PHPExcel_Calculation_LookupRef','HLOOKUP'), $args);
  21. $this->assertEquals($expectedResult, $result);
  22. }
  23. public function providerHLOOKUP()
  24. {
  25. return new testDataFileIterator('rawTestData/Calculation/LookupRef/HLOOKUP.data');
  26. }
  27. /**
  28. * @dataProvider providerVLOOKUP
  29. */
  30. public function testVLOOKUP()
  31. {
  32. $args = func_get_args();
  33. $expectedResult = array_pop($args);
  34. $result = call_user_func_array(array('PHPExcel_Calculation_LookupRef','VLOOKUP'), $args);
  35. $this->assertEquals($expectedResult, $result);
  36. }
  37. public function providerVLOOKUP()
  38. {
  39. return new testDataFileIterator('rawTestData/Calculation/LookupRef/VLOOKUP.data');
  40. }
  41. }