Skip to content

Commit

Permalink
Merge pull request #526 from hoogi91/dependabot/composer/phpoffice/ph…
Browse files Browse the repository at this point in the history
…pspreadsheet-2.1.0

Bump phpoffice/phpspreadsheet from 1.29.0 to 2.1.0
  • Loading branch information
github-actions[bot] authored May 20, 2024
2 parents 5bbd9ff + ba76a2a commit 2839c2f
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 117 deletions.
5 changes: 3 additions & 2 deletions Classes/Service/CellService.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,10 @@ private function formatString(mixed $value, Cell $cell): string
setlocale(LC_NUMERIC, $currentLocale);
}

return (string)$value;
return $value;
}

return (string)NumberFormat::toFormattedString($value, NumberFormat::FORMAT_GENERAL);
/** @var bool|float|int|RichText|string|null $value */
return NumberFormat::toFormattedString($value, NumberFormat::FORMAT_GENERAL);
}
}
2 changes: 1 addition & 1 deletion Classes/Service/SpanService.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public function getMergedCells(Worksheet $worksheet): array
}

/**
* @param array<array<int>|CellAddress|string> $references
* @param array<array{0: int, 1: int}|CellAddress|string> $references
* @return array<int>
*/
private function getCellStyleIndexesFromReferences(Worksheet $worksheet, array $references): array
Expand Down
6 changes: 3 additions & 3 deletions Tests/Unit/DataProcessing/SpreadsheetProcessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public static function processingDataProvider(): array
'firstColumnIsHeader' => false,
],
],
'alternativeExpectation' => self::validInputExpectationsOnlyWithBody(...),
'alternativeExpectations' => self::validInputExpectationsOnlyWithBody(...),
],
'left head data is set because we do not have extracted head data' => [
'processConfig' => ['value' => 'file:123|2!A1:B2'],
Expand All @@ -173,7 +173,7 @@ public static function processingDataProvider(): array
'firstColumnIsHeader' => true,
],
],
'alternativeExpectation' => self::validInputExpectationsOnlyWithBody(...),
'alternativeExpectations' => self::validInputExpectationsOnlyWithBody(...),
],
'head and foot data are not filled incorrectly when no data is given' => [
'processConfig' => ['value' => 'file:123|2!A1:B2'],
Expand All @@ -187,7 +187,7 @@ public static function processingDataProvider(): array
'firstColumnIsHeader' => false,
],
],
'alternativeExpectation' => self::validInputExpectationsWithEmptyBody(...),
'alternativeExpectations' => self::validInputExpectationsWithEmptyBody(...),
],
];
}
Expand Down
12 changes: 3 additions & 9 deletions Tests/Unit/DataProcessing/TabsProcessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,7 @@ protected function getDataProcessor(): AbstractProcessor
protected function validInputExpectations(MockObject $spreadsheetMock): void
{
// mock worksheet will be returned
$worksheetMock = $this->createConfiguredMock(
Worksheet::class,
[
'getTitle' => 'Worksheet #1',
'getHashCode' => '263df821f3760dc1ec4e',
]
);
$worksheetMock = new Worksheet(null, 'Worksheet #1');
$spreadsheetMock->expects(self::once())->method('getAllSheets')->willReturn([$worksheetMock]);

// check if extract gets called
Expand Down Expand Up @@ -80,7 +74,7 @@ public static function processingDataProvider(): array
'expectedResult' => [
'someOtherVar' => [
// key is file uid and hash code
'123263df821f3760dc1ec4e' => [
'123b8367b83d9b7fa3124b32922f50ad2fc' => [
'sheetTitle' => 'Worksheet #1',
'bodyData' => ['body-data-mocked'],
'headData' => ['head-data-mocked'],
Expand All @@ -97,7 +91,7 @@ public static function processingDataProvider(): array
'expectedResult' => [
'spreadsheets' => [
// key is file uid and hash code
'123263df821f3760dc1ec4e' => [
'123b8367b83d9b7fa3124b32922f50ad2fc' => [
'sheetTitle' => 'Worksheet #1',
'bodyData' => ['body-data-mocked'],
'headData' => ['head-data-mocked'],
Expand Down
4 changes: 1 addition & 3 deletions Tests/Unit/Service/CellServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,7 @@ public function testCatchingOfCalculatedCellValues(): void
$mockedCell->method('getValue')->willReturn('MockValue');

// build chain for style index search
$worksheetMock = $this->getMockBuilder(Worksheet::class)->disableOriginalConstructor()->getMock();
$worksheetMock->method('getParent')->willReturn($this->spreadsheet);

$worksheetMock = new Worksheet($this->spreadsheet, 'Worksheet');
$mockedCell->method('getWorksheet')->willReturn($worksheetMock);

self::assertEquals('MockValue', $this->cellService->getFormattedValue($mockedCell));
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"php": "~8.1.0 || ~8.2.0",
"ext-json": "*",
"ext-mbstring": "*",
"phpoffice/phpspreadsheet": "^1.29",
"phpoffice/phpspreadsheet": "^1.29 || ^2.0",
"typo3/cms-backend": "^11.5 || ^12.4",
"typo3/cms-core": "^11.5 || ^12.4",
"typo3/cms-extbase": "^11.5 || ^12.4",
Expand Down
134 changes: 36 additions & 98 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2839c2f

Please sign in to comment.