xlsx_to_csv.phpt 658 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('xlsx_to_csv.xlsx', 'TestSheet1')
  13. ->header(['Item', 'Cost'])
  14. ->data([
  15. ['Item_1', 'Cost_1', 10, 10.9999995],
  16. ])
  17. ->output();
  18. $fp = fopen('./tests/file.csv', 'w');
  19. $csvResult = $excel->openFile('xlsx_to_csv.xlsx')
  20. ->openSheet()
  21. ->putCSV($fp);
  22. var_dump($csvResult);
  23. ?>
  24. --CLEAN--
  25. <?php
  26. @unlink(__DIR__ . '/xlsx_to_csv.xlsx');
  27. @unlink(__DIR__ . '/file.csv');
  28. ?>
  29. --EXPECT--
  30. bool(true)