Skip to content

Commit 9ab0177

Browse files
committed
Prevent fatal error when fetching rows without values
1 parent dd6e568 commit 9ab0177

2 files changed

Lines changed: 43 additions & 0 deletions

File tree

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"spreadsheetId": "eae3913a86de8d5ccfe841fd3c7ec50dba3902045232",
3+
"valueRanges": [
4+
{
5+
"range": "Sheet!A1:C10",
6+
"majorDimension": "ROWS",
7+
"values": [
8+
["Header 1", "Header 2", "Header 3"],
9+
["A2", "B2", "C2"],
10+
["A3", "B3", "C3"],
11+
["A4", "B4", "C4"],
12+
["A5", "B5", "C5"],
13+
["A6", "B6", "C6"],
14+
["A7", "B7", "C7"],
15+
["A8", "B8", "C8"],
16+
["A9", "B9", "C9"],
17+
["A10", "B10", "C10"]
18+
]
19+
},
20+
{
21+
"range": "Sheet!A11:C20",
22+
"majorDimension": "ROWS",
23+
"values": null
24+
}
25+
]
26+
}

src/adapter/etl-adapter-google-sheet/tests/Flow/ETL/Adapter/GoogleSheet/Tests/Integration/GoogleSheetExtractorTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,23 @@ public function test_extract_with_batches() : void
100100
self::assertCount(19, $rows);
101101
}
102102

103+
public function test_extract_with_batches_containing_empty_rows() : void
104+
{
105+
$extractor = from_google_sheet(
106+
$this->context->sheets(__DIR__ . '/../Fixtures/batch-empty-rows.json'),
107+
'1234567890',
108+
'Sheet',
109+
);
110+
$extractor->withRowsPerPage(10);
111+
112+
$rows = df()
113+
->extract($extractor)
114+
->fetch()
115+
->toArray();
116+
117+
self::assertCount(9, $rows);
118+
}
119+
103120
public function test_extract_with_batches_without_header() : void
104121
{
105122
$extractor = from_google_sheet(

0 commit comments

Comments
 (0)