ODS Reader should support num-rows-repeated for non empty rows (#335)

This commit is contained in:
Adrien Loison authored and GitHub committed 2016-10-17 10:51:12 -07:00
1 parent 5ef5647558
commit 2fafb63115
3 files changed
+17 -8

No files matched your search

+4 -8
View File
@@ -131,13 +131,10 @@ class RowIterator implements IteratorInterface
/** /**
* Returns whether we need data for the next row to be processed. * Returns whether we need data for the next row to be processed.
* We don't need to read data if: * We DO need to read data if:
* we have already read at least one row * - we have not read any rows yet
* AND * OR
* we need to preserve empty rows * - the next row to be processed immediately follows the last read row
* AND
* the last row that was read is not the row that need to be processed
* (i.e. if we need to return empty rows)
* *
* @return bool Whether we need data for the next row to be processed. * @return bool Whether we need data for the next row to be processed.
*/ */
@@ -147,7 +144,6 @@ class RowIterator implements IteratorInterface
return ( return (
!$hasReadAtLeastOneRow || !$hasReadAtLeastOneRow ||
!$this->shouldPreserveEmptyRows ||
$this->lastRowIndexProcessed === $this->nextRowIndexToBeProcessed - 1 $this->lastRowIndexProcessed === $this->nextRowIndexToBeProcessed - 1
); );
} }
+13
View File
@@ -78,6 +78,19 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
$this->assertEquals([['foo']], $allRows); $this->assertEquals([['foo']], $allRows);
} }
/**
* @return void
*/
public function testReadShouldSupportNumberRowsRepeated()
{
$allRows = $this->getAllRowsForFile('sheet_with_number_rows_repeated.ods');
$expectedRows = [
['foo', 10.43],
['foo', 10.43],
];
$this->assertEquals($expectedRows, $allRows);
}
/** /**
* @return void * @return void
*/ */