printed.phpt 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. --TEST--
  2. Check for vtiful presence
  3. --SKIPIF--
  4. <?php if (!extension_loaded("xlswriter")) print "skip"; ?>
  5. --FILE--
  6. <?php
  7. try {
  8. $config = ['path' => './tests'];
  9. $excel = new \Vtiful\Kernel\Excel($config);
  10. $excel->setPortrait();
  11. } catch (\Exception $exception) {
  12. var_dump($exception->getCode());
  13. var_dump($exception->getMessage());
  14. }
  15. $config = ['path' => './tests'];
  16. $excel = new \Vtiful\Kernel\Excel($config);
  17. $excel->fileName('printed_portrait.xlsx', 'sheet1')
  18. ->setPortrait()
  19. ->output();
  20. var_dump($excel);
  21. $config = ['path' => './tests'];
  22. $excel = new \Vtiful\Kernel\Excel($config);
  23. $excel->fileName('printed_landscape.xlsx', 'sheet1')
  24. ->setLandscape()
  25. ->output();
  26. var_dump($excel);
  27. $config = ['path' => './tests'];
  28. $excel = new \Vtiful\Kernel\Excel($config);
  29. $excel->fileName('printed_scale.xlsx', 'sheet1')
  30. ->setPrintScale(180)
  31. ->output();
  32. var_dump($excel);
  33. ?>
  34. --CLEAN--
  35. <?php
  36. @unlink(__DIR__ . '/printed_portrait.xlsx');
  37. @unlink(__DIR__ . '/printed_landscape.xlsx');
  38. @unlink(__DIR__ . '/printed_scale.xlsx');
  39. ?>
  40. --EXPECT--
  41. int(130)
  42. string(51) "Please create a file first, use the filename method"
  43. object(Vtiful\Kernel\Excel)#3 (3) {
  44. ["config":"Vtiful\Kernel\Excel":private]=>
  45. array(1) {
  46. ["path"]=>
  47. string(7) "./tests"
  48. }
  49. ["fileName":"Vtiful\Kernel\Excel":private]=>
  50. string(29) "./tests/printed_portrait.xlsx"
  51. ["read_row_type":"Vtiful\Kernel\Excel":private]=>
  52. NULL
  53. }
  54. object(Vtiful\Kernel\Excel)#1 (3) {
  55. ["config":"Vtiful\Kernel\Excel":private]=>
  56. array(1) {
  57. ["path"]=>
  58. string(7) "./tests"
  59. }
  60. ["fileName":"Vtiful\Kernel\Excel":private]=>
  61. string(30) "./tests/printed_landscape.xlsx"
  62. ["read_row_type":"Vtiful\Kernel\Excel":private]=>
  63. NULL
  64. }
  65. object(Vtiful\Kernel\Excel)#3 (3) {
  66. ["config":"Vtiful\Kernel\Excel":private]=>
  67. array(1) {
  68. ["path"]=>
  69. string(7) "./tests"
  70. }
  71. ["fileName":"Vtiful\Kernel\Excel":private]=>
  72. string(26) "./tests/printed_scale.xlsx"
  73. ["read_row_type":"Vtiful\Kernel\Excel":private]=>
  74. NULL
  75. }