Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php declare(strict_types=1); namespace PhpOffice\PhpSpreadsheetTests\Reader\Gnumeric; ..
Decoded Output download
<?php
declare(strict_types=1);
namespace PhpOffice\PhpSpreadsheetTests\Reader\Gnumeric;
use PhpOffice\PhpSpreadsheet\Reader\Gnumeric;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
use PHPUnit\Framework\TestCase;
class HiddenWorksheetTest extends TestCase
{
public function testPageSetup(): void
{
$filename = 'tests/data/Reader/Gnumeric/HiddenSheet.gnumeric';
$reader = new Gnumeric();
$spreadsheet = $reader->load($filename);
$assertions = $this->worksheetAssertions();
$sheetCount = 0;
foreach ($spreadsheet->getAllSheets() as $worksheet) {
if (!array_key_exists($worksheet->getTitle(), $assertions)) {
self::fail('Unexpected worksheet ' . $worksheet->getTitle());
}
++$sheetCount;
$sheetAssertions = $assertions[$worksheet->getTitle()];
foreach ($sheetAssertions as $test => $expectedResult) {
$actualResult = $worksheet->getSheetState();
self::assertSame(
$expectedResult,
$actualResult,
"Failed asserting sheet state {$expectedResult} for Worksheet '{$worksheet->getTitle()}' {$test}"
);
}
}
self::assertCount($sheetCount, $assertions);
$spreadsheet->disconnectWorksheets();
}
private function worksheetAssertions(): array
{
return [
'Sheet1' => [
'sheetState' => Worksheet::SHEETSTATE_VISIBLE,
],
'Sheet2' => [
'sheetState' => Worksheet::SHEETSTATE_HIDDEN,
],
];
}
}
?>
Did this file decode correctly?
Original Code
<?php
declare(strict_types=1);
namespace PhpOffice\PhpSpreadsheetTests\Reader\Gnumeric;
use PhpOffice\PhpSpreadsheet\Reader\Gnumeric;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
use PHPUnit\Framework\TestCase;
class HiddenWorksheetTest extends TestCase
{
public function testPageSetup(): void
{
$filename = 'tests/data/Reader/Gnumeric/HiddenSheet.gnumeric';
$reader = new Gnumeric();
$spreadsheet = $reader->load($filename);
$assertions = $this->worksheetAssertions();
$sheetCount = 0;
foreach ($spreadsheet->getAllSheets() as $worksheet) {
if (!array_key_exists($worksheet->getTitle(), $assertions)) {
self::fail('Unexpected worksheet ' . $worksheet->getTitle());
}
++$sheetCount;
$sheetAssertions = $assertions[$worksheet->getTitle()];
foreach ($sheetAssertions as $test => $expectedResult) {
$actualResult = $worksheet->getSheetState();
self::assertSame(
$expectedResult,
$actualResult,
"Failed asserting sheet state {$expectedResult} for Worksheet '{$worksheet->getTitle()}' {$test}"
);
}
}
self::assertCount($sheetCount, $assertions);
$spreadsheet->disconnectWorksheets();
}
private function worksheetAssertions(): array
{
return [
'Sheet1' => [
'sheetState' => Worksheet::SHEETSTATE_VISIBLE,
],
'Sheet2' => [
'sheetState' => Worksheet::SHEETSTATE_HIDDEN,
],
];
}
}
Function Calls
None |
Stats
MD5 | c355cb13fb161b71e4bec59804a1d59c |
Eval Count | 0 |
Decode Time | 79 ms |