Files
Adrien Crivelli ec4098c8fd Strict mode for all tests
While we might never be able to have 100% of our code strict, we can at
the very least do it for all of our tests. This ensures that our tests
are using our API with the types as intended by the test author, and not
silently be cast to what our API requires.
2023-09-07 17:44:56 +08:00

48 lines
1.5 KiB
PHP

<?php
declare(strict_types=1);
namespace PhpOffice\PhpSpreadsheetTests\Worksheet\Table;
use PhpOffice\PhpSpreadsheet\Worksheet\Table;
use PhpOffice\PhpSpreadsheet\Worksheet\Table\TableStyle;
class TableStyleTest extends SetupTeardown
{
private const INITIAL_RANGE = 'H2:O256';
public function testVariousSets(): void
{
$table = new Table(self::INITIAL_RANGE);
$style = $table->getStyle();
$result = $style->setTheme(TableStyle::TABLE_STYLE_DARK1);
self::assertInstanceOf(TableStyle::class, $result);
self::assertEquals(TableStyle::TABLE_STYLE_DARK1, $style->getTheme());
$result = $style->setShowFirstColumn(true);
self::assertInstanceOf(TableStyle::class, $result);
self::assertTrue($style->getShowFirstColumn());
$result = $style->setShowLastColumn(true);
self::assertInstanceOf(TableStyle::class, $result);
self::assertTrue($style->getShowLastColumn());
$result = $style->setShowRowStripes(true);
self::assertInstanceOf(TableStyle::class, $result);
self::assertTrue($style->getShowRowStripes());
$result = $style->setShowColumnStripes(true);
self::assertInstanceOf(TableStyle::class, $result);
self::assertTrue($style->getShowColumnStripes());
}
public function testTable(): void
{
$table = new Table(self::INITIAL_RANGE);
$style = new TableStyle();
$style->setTable($table);
self::assertEquals($table, $style->getTable());
}
}