multiple_file.phpt 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. --TEST--
  2. Check for vtiful presence
  3. --SKIPIF--
  4. <?php if (!extension_loaded("xlswriter")) print "skip"; ?>
  5. --FILE--
  6. <?php
  7. $config = [
  8. 'path' => './tests',
  9. ];
  10. $lastFilePath = NULL;
  11. for ($index = 0; $index < 100; $index++) {
  12. $fileObject = new \Vtiful\Kernel\Excel($config);
  13. $fileObject = $fileObject->fileName('tutorial' . $index . '.xlsx');
  14. $fileHandle = $fileObject->getHandle();
  15. $format = new \Vtiful\Kernel\Format($fileHandle);
  16. $alignStyle = $format->align(
  17. \Vtiful\Kernel\Format::FORMAT_ALIGN_CENTER,
  18. \Vtiful\Kernel\Format::FORMAT_ALIGN_VERTICAL_CENTER
  19. )->toResource();
  20. $lastFilePath = $fileObject->header(['name', 'age'])
  21. ->data([
  22. ['viest', 21],
  23. ['wjx', 21],
  24. ])
  25. ->setRow('A1', 50, $alignStyle)
  26. ->setRow('A2:A3', 50, $alignStyle)
  27. ->output();
  28. }
  29. var_dump($lastFilePath);
  30. ?>
  31. --CLEAN--
  32. <?php
  33. for ($index = 0; $index < 100; $index++) {
  34. @unlink(__DIR__ . '/tutorial' . $index . '.xlsx');
  35. }
  36. ?>
  37. --EXPECT--
  38. string(23) "./tests/tutorial99.xlsx"