printed.phpt 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. ?>
  28. --CLEAN--
  29. <?php
  30. @unlink(__DIR__ . '/printed_portrait.xlsx');
  31. @unlink(__DIR__ . '/printed_landscape.xlsx');
  32. ?>
  33. --EXPECT--
  34. int(130)
  35. string(51) "Please create a file first, use the filename method"
  36. object(Vtiful\Kernel\Excel)#3 (3) {
  37. ["config":"Vtiful\Kernel\Excel":private]=>
  38. array(1) {
  39. ["path"]=>
  40. string(7) "./tests"
  41. }
  42. ["fileName":"Vtiful\Kernel\Excel":private]=>
  43. string(29) "./tests/printed_portrait.xlsx"
  44. ["read_row_type":"Vtiful\Kernel\Excel":private]=>
  45. NULL
  46. }
  47. object(Vtiful\Kernel\Excel)#1 (3) {
  48. ["config":"Vtiful\Kernel\Excel":private]=>
  49. array(1) {
  50. ["path"]=>
  51. string(7) "./tests"
  52. }
  53. ["fileName":"Vtiful\Kernel\Excel":private]=>
  54. string(30) "./tests/printed_landscape.xlsx"
  55. ["read_row_type":"Vtiful\Kernel\Excel":private]=>
  56. NULL
  57. }