format_background.phpt 795 B

12345678910111213141516171819202122232425262728293031323334353637
  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. $fileObject = new \Vtiful\Kernel\Excel($config);
  11. $fileObject = $fileObject->fileName('format_background.xlsx');
  12. $fileHandle = $fileObject->getHandle();
  13. $format = new \Vtiful\Kernel\Format($fileHandle);
  14. $style = $format->background(
  15. \Vtiful\Kernel\Format::COLOR_RED,
  16. \Vtiful\Kernel\Format::PATTERN_LIGHT_UP
  17. )->toResource();
  18. $filePath = $fileObject->header(['name', 'age'])
  19. ->data([
  20. ['viest', 21],
  21. ['wjx', 21]
  22. ])
  23. ->setRow('A1', 50, $style)
  24. ->output();
  25. var_dump($filePath);
  26. ?>
  27. --CLEAN--
  28. <?php
  29. @unlink(__DIR__ . '/format_background.xlsx');
  30. ?>
  31. --EXPECT--
  32. string(30) "./tests/format_background.xlsx"