xlsx_to_csv.phpt 640 B

12345678910111213141516171819202122232425262728293031
  1. --TEST--
  2. Check for vtiful presence
  3. --SKIPIF--
  4. require __DIR__ . '/include/skipif.inc';
  5. skip_disable_reader();
  6. --FILE--
  7. <?php
  8. $config = ['path' => './tests'];
  9. $excel = new \Vtiful\Kernel\Excel($config);
  10. $filePath = $excel->fileName('tutorial.xlsx', 'TestSheet1')
  11. ->header(['Item', 'Cost'])
  12. ->data([
  13. ['Item_1', 'Cost_1', 10, 10.9999995],
  14. ])
  15. ->output();
  16. $fp = fopen('./tests/file.csv', 'w');
  17. $csvResult = $excel->openFile('tutorial.xlsx')
  18. ->openSheet()
  19. ->putCSV($fp);
  20. var_dump($csvResult);
  21. ?>
  22. --CLEAN--
  23. <?php
  24. @unlink(__DIR__ . '/tutorial.xlsx');
  25. @unlink(__DIR__ . '/file.csv');
  26. ?>
  27. --EXPECT--
  28. bool(true)