TableStyleTest.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace PhpOffice\PhpSpreadsheetTests\Worksheet\Table;
  3. use PhpOffice\PhpSpreadsheet\Worksheet\Table;
  4. use PhpOffice\PhpSpreadsheet\Worksheet\Table\TableStyle;
  5. class TableStyleTest extends SetupTeardown
  6. {
  7. private const INITIAL_RANGE = 'H2:O256';
  8. public function testVariousSets(): void
  9. {
  10. $table = new Table(self::INITIAL_RANGE);
  11. $style = $table->getStyle();
  12. $result = $style->setTheme(TableStyle::TABLE_STYLE_DARK1);
  13. self::assertInstanceOf(TableStyle::class, $result);
  14. self::assertEquals(TableStyle::TABLE_STYLE_DARK1, $style->getTheme());
  15. $result = $style->setShowFirstColumn(true);
  16. self::assertInstanceOf(TableStyle::class, $result);
  17. self::assertTrue($style->getShowFirstColumn());
  18. $result = $style->setShowLastColumn(true);
  19. self::assertInstanceOf(TableStyle::class, $result);
  20. self::assertTrue($style->getShowLastColumn());
  21. $result = $style->setShowRowStripes(true);
  22. self::assertInstanceOf(TableStyle::class, $result);
  23. self::assertTrue($style->getShowRowStripes());
  24. $result = $style->setShowColumnStripes(true);
  25. self::assertInstanceOf(TableStyle::class, $result);
  26. self::assertTrue($style->getShowColumnStripes());
  27. }
  28. public function testTable(): void
  29. {
  30. $table = new Table(self::INITIAL_RANGE);
  31. $style = new TableStyle();
  32. $style->setTable($table);
  33. self::assertEquals($table, $style->getTable());
  34. }
  35. }