open_xlsx_next_row_skip_rows.phpt 872 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. --TEST--
  2. Check for vtiful presence
  3. --SKIPIF--
  4. <?php
  5. require __DIR__ . '/include/skipif.inc';
  6. skip_disable_reader();
  7. ?>
  8. --FILE--
  9. <?php
  10. $config = ['path' => './tests'];
  11. $excel = new \Vtiful\Kernel\Excel($config);
  12. $filePath = $excel->fileName('open_xlsx_next_row_skip_rows.xlsx', 'TestSheet1')
  13. ->header(['Item', 'Cost'])
  14. ->data([
  15. ['Item_1', 'Cost_1', 10, 10.9999995],
  16. ['Item_2', 'Cost_2', 10, 10.9999995],
  17. ['Item_3', 'Cost_3', 10, 10.9999995],
  18. ])
  19. ->output();
  20. $excel->openFile('open_xlsx_next_row_skip_rows.xlsx')
  21. ->openSheet()
  22. ->setSkipRows(3);
  23. while (is_array($data = $excel->nextRow())) {
  24. var_dump($data);
  25. }
  26. ?>
  27. --CLEAN--
  28. <?php
  29. @unlink(__DIR__ . '/open_xlsx_next_row_skip_rows.xlsx');
  30. ?>
  31. --EXPECT--
  32. array(4) {
  33. [0]=>
  34. string(6) "Item_3"
  35. [1]=>
  36. string(6) "Cost_3"
  37. [2]=>
  38. int(10)
  39. [3]=>
  40. float(10.9999995)
  41. }