data_string_key.phpt 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. $excel = new \Vtiful\Kernel\Excel([
  11. 'path' => './tests',
  12. ]);
  13. $fileObject = $excel->constMemory('data_string_key.xlsx', NULL, false);
  14. $fileHandle = $fileObject->getHandle();
  15. $path = $fileObject->header(['name', 'age'])
  16. ->data([
  17. ['name'=>'viest', 'age' => 21, 1 => 23],
  18. ['name'=>'viest', 'age' => 21],
  19. ['name'=>'viest', 'age' => 21],
  20. ['viest', 21],
  21. ])
  22. ->output();
  23. $excel->openFile('data_string_key.xlsx')
  24. ->openSheet();
  25. var_dump($excel->nextRow());
  26. var_dump($excel->nextRow());
  27. var_dump($excel->nextRow());
  28. var_dump($excel->nextRow());
  29. ?>
  30. --CLEAN--
  31. <?php
  32. @unlink(__DIR__ . '/data_string_key.xlsx');
  33. ?>
  34. --EXPECT--
  35. array(2) {
  36. [0]=>
  37. string(4) "name"
  38. [1]=>
  39. string(3) "age"
  40. }
  41. array(2) {
  42. [0]=>
  43. string(5) "viest"
  44. [1]=>
  45. int(23)
  46. }
  47. array(2) {
  48. [0]=>
  49. string(5) "viest"
  50. [1]=>
  51. int(21)
  52. }
  53. array(2) {
  54. [0]=>
  55. string(5) "viest"
  56. [1]=>
  57. int(21)
  58. }