mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-19 14:36:48 +00:00
Additional Coverage for Reader Xls (#3340)
* Additional Coverage for Reader Xls More than 750 lines are newly covered, increasing overall coverage on my machine from 91.14% to 93.09%. * Update FormulasTest.php
This commit is contained in:
@@ -4,39 +4,30 @@ namespace PhpOffice\PhpSpreadsheetTests\Reader\Xls;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Reader\Xls;
|
||||
use PhpOffice\PhpSpreadsheet\Style\Conditional;
|
||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ConditionalFormattingExpressionTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var Worksheet
|
||||
*/
|
||||
protected $sheet;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$filename = 'tests/data/Reader/XLS/CF_Expression_Comparisons.xls';
|
||||
$reader = new Xls();
|
||||
$spreadsheet = $reader->load($filename);
|
||||
$this->sheet = $spreadsheet->getActiveSheet();
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider conditionalFormattingProvider
|
||||
*/
|
||||
public function testReadConditionalFormatting(string $expectedRange, array $expectedRule): void
|
||||
{
|
||||
$hasConditionalStyles = $this->sheet->conditionalStylesExists($expectedRange);
|
||||
$filename = 'tests/data/Reader/XLS/CF_Expression_Comparisons.xls';
|
||||
$reader = new Xls();
|
||||
$spreadsheet = $reader->load($filename);
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
$hasConditionalStyles = $sheet->conditionalStylesExists($expectedRange);
|
||||
self::assertTrue($hasConditionalStyles);
|
||||
|
||||
$conditionalStyles = $this->sheet->getConditionalStyles($expectedRange);
|
||||
$conditionalStyles = $sheet->getConditionalStyles($expectedRange);
|
||||
|
||||
foreach ($conditionalStyles as $index => $conditionalStyle) {
|
||||
self::assertSame($expectedRule[$index]['type'], $conditionalStyle->getConditionType());
|
||||
self::assertSame($expectedRule[$index]['operator'], $conditionalStyle->getOperatorType());
|
||||
self::assertSame($expectedRule[$index]['conditions'], $conditionalStyle->getConditions());
|
||||
}
|
||||
$spreadsheet->disconnectWorksheets();
|
||||
}
|
||||
|
||||
public function conditionalFormattingProvider(): array
|
||||
|
||||
Reference in New Issue
Block a user