open_xlsx_next_cell_callback.phpt 768 B

123456789101112131415161718192021222324252627282930313233
  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('tutorial.xlsx')
  13. ->header(['Item', 'Cost'])
  14. ->data([
  15. ['Item_1', 'Cost_1'],
  16. ])
  17. ->output();
  18. $excel->openFile('tutorial.xlsx')->nextCellCallback(function ($row, $cell, $data) {
  19. echo 'cell:' . $cell . ', row:' . $row . ', value:' . $data . PHP_EOL;
  20. });
  21. ?>
  22. --CLEAN--
  23. <?php
  24. @unlink(__DIR__ . '/tutorial.xlsx');
  25. ?>
  26. --EXPECT--
  27. cell:0, row:0, value:Item
  28. cell:1, row:0, value:Cost
  29. cell:1, row:0, value:XLSX_ROW_END
  30. cell:0, row:1, value:Item_1
  31. cell:1, row:1, value:Cost_1
  32. cell:1, row:1, value:XLSX_ROW_END