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\Xlsx; use..

Decoded Output download

<?php

declare(strict_types=1);

namespace PhpOffice\PhpSpreadsheetTests\Reader\Xlsx;

use PhpOffice\PhpSpreadsheet\IOFactory;
use PHPUnit\Framework\TestCase;

class DefaultFillTest extends TestCase
{
    public function testDefaultFill(): void
    {
        // default fill pattern doesn't specify filltype
        $filename = 'tests/data/Reader/XLSX/pr1769g.py.xlsx';
        $file = 'zip://';
        $file .= $filename;
        $file .= '#xl/styles.xml';
        $data = file_get_contents($file);
        // confirm that file contains expected empty xml tag
        if ($data === false) {
            self::fail('Unable to read file');
        } else {
            self::assertStringContainsString('<patternFill/>', $data);
        }
        $reader = IOFactory::createReader('Xlsx');
        $spreadsheet = $reader->load($filename);
        $sheet = $spreadsheet->getActiveSheet();
        self::assertSame('none', $sheet->getCell('A1')->getStyle()->getFill()->getFillType());
        self::assertSame('none', $sheet->getCell('D4')->getStyle()->getFill()->getFillType());
        self::assertSame('none', $sheet->getCell('J16')->getStyle()->getFill()->getFillType());
        self::assertSame('solid', $sheet->getCell('C2')->getStyle()->getFill()->getFillType());
    }

    public function testDefaultConditionalFill(): void
    {
        // default fill pattern for a conditional style where the filltype is not defined
        $filename = 'tests/data/Reader/XLSX/pr2050cf-fill.xlsx';
        $reader = IOFactory::createReader('Xlsx');
        $spreadsheet = $reader->load($filename);

        $style = $spreadsheet->getActiveSheet()->getConditionalStyles('A1')[0]->getStyle();
        self::assertSame('solid', $style->getFill()->getFillType());
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

declare(strict_types=1);

namespace PhpOffice\PhpSpreadsheetTests\Reader\Xlsx;

use PhpOffice\PhpSpreadsheet\IOFactory;
use PHPUnit\Framework\TestCase;

class DefaultFillTest extends TestCase
{
    public function testDefaultFill(): void
    {
        // default fill pattern doesn't specify filltype
        $filename = 'tests/data/Reader/XLSX/pr1769g.py.xlsx';
        $file = 'zip://';
        $file .= $filename;
        $file .= '#xl/styles.xml';
        $data = file_get_contents($file);
        // confirm that file contains expected empty xml tag
        if ($data === false) {
            self::fail('Unable to read file');
        } else {
            self::assertStringContainsString('<patternFill/>', $data);
        }
        $reader = IOFactory::createReader('Xlsx');
        $spreadsheet = $reader->load($filename);
        $sheet = $spreadsheet->getActiveSheet();
        self::assertSame('none', $sheet->getCell('A1')->getStyle()->getFill()->getFillType());
        self::assertSame('none', $sheet->getCell('D4')->getStyle()->getFill()->getFillType());
        self::assertSame('none', $sheet->getCell('J16')->getStyle()->getFill()->getFillType());
        self::assertSame('solid', $sheet->getCell('C2')->getStyle()->getFill()->getFillType());
    }

    public function testDefaultConditionalFill(): void
    {
        // default fill pattern for a conditional style where the filltype is not defined
        $filename = 'tests/data/Reader/XLSX/pr2050cf-fill.xlsx';
        $reader = IOFactory::createReader('Xlsx');
        $spreadsheet = $reader->load($filename);

        $style = $spreadsheet->getActiveSheet()->getConditionalStyles('A1')[0]->getStyle();
        self::assertSame('solid', $style->getFill()->getFillType());
    }
}

Function Calls

None

Variables

None

Stats

MD5 e700d0fa75bc3646603ee5e61ade3a82
Eval Count 0
Decode Time 80 ms