mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-08-19 20:51:46 +00:00
ec4098c8fd
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.
47 lines
1.5 KiB
PHP
47 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Worksheet;
|
|
|
|
use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException;
|
|
use PhpOffice\PhpSpreadsheet\Worksheet\SheetView;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class SheetViewTest extends TestCase
|
|
{
|
|
public function testView(): void
|
|
{
|
|
$sheetView = new SheetView();
|
|
self::assertSame(SheetView::SHEETVIEW_NORMAL, $sheetView->getView());
|
|
$sheetView->setView(SheetView::SHEETVIEW_PAGE_LAYOUT);
|
|
self::assertSame(SheetView::SHEETVIEW_PAGE_LAYOUT, $sheetView->getView());
|
|
$sheetView->setView(null);
|
|
self::assertSame(SheetView::SHEETVIEW_NORMAL, $sheetView->getView());
|
|
}
|
|
|
|
public function testBadView(): void
|
|
{
|
|
$this->expectException(PhpSpreadsheetException::class);
|
|
$this->expectExceptionMessage('Invalid sheetview layout type.');
|
|
$sheetView = new SheetView();
|
|
$sheetView->setView('unknown');
|
|
}
|
|
|
|
public function testBadZoomScaleNormal(): void
|
|
{
|
|
$this->expectException(PhpSpreadsheetException::class);
|
|
$this->expectExceptionMessage('Scale must be greater than or equal to 1.');
|
|
$sheetView = new SheetView();
|
|
$sheetView->setZoomScaleNormal(0);
|
|
}
|
|
|
|
public function testBadZoomScale(): void
|
|
{
|
|
$this->expectException(PhpSpreadsheetException::class);
|
|
$this->expectExceptionMessage('Scale must be greater than or equal to 1.');
|
|
$sheetView = new SheetView();
|
|
$sheetView->setZoomScale(0);
|
|
}
|
|
}
|