const_memory_index_out_range.phpt 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. --TEST--
  2. Check for vtiful presence
  3. --SKIPIF--
  4. <?php if (!extension_loaded("xlswriter")) print "skip"; ?>
  5. --FILE--
  6. <?php
  7. try {
  8. $excel = new \Vtiful\Kernel\Excel([
  9. 'path' => './',
  10. ]);
  11. $fileObject = $excel->constMemory('test.xlsx');
  12. $fileHandle = $fileObject->getHandle();
  13. $format = new \Vtiful\Kernel\Format($fileHandle);
  14. $boldStyle = $format->bold()->toResource();
  15. $fileObject->header(['name', 'age'])
  16. ->data([['viest', 21]])
  17. ->mergeCells('A1:C1', 'aaaa')
  18. ->output();
  19. } catch (\Vtiful\Kernel\Exception $exception) {
  20. echo $exception->getCode() . PHP_EOL;
  21. echo $exception->getMessage() . PHP_EOL;
  22. }
  23. try {
  24. $excel = new \Vtiful\Kernel\Excel([
  25. 'path' => './',
  26. ]);
  27. $fileObject = $excel->constMemory('test.xlsx');
  28. $fileHandle = $fileObject->getHandle();
  29. $format = new \Vtiful\Kernel\Format($fileHandle);
  30. $boldStyle = $format->bold()->toResource();
  31. $fileObject->header(['name', 'age'])
  32. ->data([['viest', 21]])
  33. ->setRow('A1', 200)
  34. ->output();
  35. } catch (\Vtiful\Kernel\Exception $exception) {
  36. echo $exception->getCode() . PHP_EOL;
  37. echo $exception->getMessage() . PHP_EOL;
  38. }
  39. try {
  40. $excel = new \Vtiful\Kernel\Excel([
  41. 'path' => './',
  42. ]);
  43. $fileObject = $excel->constMemory('test.xlsx');
  44. $fileHandle = $fileObject->getHandle();
  45. $format = new \Vtiful\Kernel\Format($fileHandle);
  46. $boldStyle = $format->bold()->toResource();
  47. $fileObject->header(['name', 'age'])
  48. ->data([['viest', 21]])
  49. ->autoFilter('A1:C1')
  50. ->output();
  51. } catch (\Vtiful\Kernel\Exception $exception) {
  52. echo $exception->getCode() . PHP_EOL;
  53. echo $exception->getMessage() . PHP_EOL;
  54. }
  55. ?>
  56. --CLEAN--
  57. <?php
  58. @unlink(__DIR__ . '/tutorial.xlsx');
  59. ?>
  60. --EXPECT--
  61. 170
  62. In const memory mode, you cannot modify the placed cells
  63. 170
  64. In const memory mode, you cannot modify the placed cells
  65. 170
  66. In const memory mode, you cannot modify the placed cells