protected function SpreadsheetIteratorTest::getWorksheet in Migrate Spreadsheet 8
Same name and namespace in other branches
- 2.0.x tests/src/Unit/SpreadsheetIteratorTest.php \Drupal\Tests\migrate_spreadsheet\Unit\SpreadsheetIteratorTest::getWorksheet()
Populates a testing worksheet.
Return value
\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet A PhpSpreadsheet worksheet object.
1 call to SpreadsheetIteratorTest::getWorksheet()
- SpreadsheetIteratorTest::setUp in tests/
src/ Unit/ SpreadsheetIteratorTest.php
File
- tests/
src/ Unit/ SpreadsheetIteratorTest.php, line 235
Class
- SpreadsheetIteratorTest
- Tests the spreadsheet iterator.
Namespace
Drupal\Tests\migrate_spreadsheet\UnitCode
protected function getWorksheet() {
if (!isset($this->worksheet)) {
// Test case:
// - origin: B3;
// - header_row: 2.
$this->worksheet = (new Spreadsheet())
->getActiveSheet()
->setCellValue('B2', 'column b')
->setCellValue('C2', 'column c')
->setCellValue('D2', 'column d')
->setCellValue('E2', 'column e')
->setCellValue('G2', 'column g')
->setCellValue('B3', 'cell b0')
->setCellValue('C3', 'cell c0')
->setCellValue('D3', 'cell d0')
->setCellValue('E3', 'cell e0')
->setCellValue('F3', 'cell f0')
->setCellValue('G3', 'cell g0')
->setCellValue('B4', 'cell b1')
->setCellValue('C4', 'cell c1')
->setCellValue('D4', 7.0)
->setCellValue('E4', '=D4+3.23')
->setCellValue('F4', 'cell f1')
->setCellValue('G4', 'cell g1')
->setCellValue('B5', 'cell b2')
->setCellValue('C5', 'cell c2')
->setCellValue('D5', 'cell d2')
->setCellValue('E5', 'cell e2')
->setCellValue('F5', 'cell f2')
->setCellValue('G5', 'cell g2');
}
return $this->worksheet;
}