Tests for #184
This commit is contained in:
1 parent
049fd990b9
commit
2b1160bb33
9 files changed
+103
No files matched your search
@@ -343,6 +343,38 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals($expectedRows, $allRows);
|
$this->assertEquals($expectedRows, $allRows);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* https://github.com/box/spout/issues/184
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testReadShouldInludeRowsWithZerosOnly()
|
||||||
|
{
|
||||||
|
$allRows = $this->getAllRowsForFile('sheet_with_zeros_in_row.csv');
|
||||||
|
|
||||||
|
$expectedRows = [
|
||||||
|
['A', 'B', 'C'],
|
||||||
|
['1', '2', '3'],
|
||||||
|
['0', '0', '0']
|
||||||
|
];
|
||||||
|
$this->assertEquals($expectedRows, $allRows, 'There should be only 3 rows, because zeros (0) are valid values');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* https://github.com/box/spout/issues/184
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testReadShouldCreateOutputEmptyCellPreserved()
|
||||||
|
{
|
||||||
|
$allRows = $this->getAllRowsForFile('sheet_with_empty_cells.csv');
|
||||||
|
|
||||||
|
$expectedRows = [
|
||||||
|
['A', 'B', 'C'],
|
||||||
|
['0', '', ''],
|
||||||
|
['1', '1', '']
|
||||||
|
];
|
||||||
|
$this->assertEquals($expectedRows, $allRows, 'There should be 3 rows, with equal length');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $fileName
|
* @param string $fileName
|
||||||
* @param string|void $fieldDelimiter
|
* @param string|void $fieldDelimiter
|
||||||
|
|||||||
@@ -387,6 +387,38 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
$reader->open('php://memory');
|
$reader->open('php://memory');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* https://github.com/box/spout/issues/184
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testReadShouldInludeRowsWithZerosOnly()
|
||||||
|
{
|
||||||
|
$allRows = $this->getAllRowsForFile('sheet_with_zeros_in_row.ods');
|
||||||
|
|
||||||
|
$expectedRows = [
|
||||||
|
['A', 'B', 'C'],
|
||||||
|
['1', '2', '3'],
|
||||||
|
['0', '0', '0']
|
||||||
|
];
|
||||||
|
$this->assertEquals($expectedRows, $allRows, 'There should be only 3 rows, because zeros (0) are valid values');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* https://github.com/box/spout/issues/184
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testReadShouldCreateOutputEmptyCellPreserved()
|
||||||
|
{
|
||||||
|
$allRows = $this->getAllRowsForFile('sheet_with_empty_cells.ods');
|
||||||
|
|
||||||
|
$expectedRows = [
|
||||||
|
['A', 'B', 'C'],
|
||||||
|
['0', '', ''],
|
||||||
|
['1', '1', '']
|
||||||
|
];
|
||||||
|
$this->assertEquals($expectedRows, $allRows, 'There should be 3 rows, with equal length');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $fileName
|
* @param string $fileName
|
||||||
* @return array All the read rows the given file
|
* @return array All the read rows the given file
|
||||||
|
|||||||
@@ -428,6 +428,39 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
$reader->open('php://memory');
|
$reader->open('php://memory');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* https://github.com/box/spout/issues/184
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testReadShouldInludeRowsWithZerosOnly()
|
||||||
|
{
|
||||||
|
$allRows = $this->getAllRowsForFile('sheet_with_zeros_in_row.xlsx');
|
||||||
|
|
||||||
|
$expectedRows = [
|
||||||
|
['A', 'B', 'C'],
|
||||||
|
['1', '2', '3'],
|
||||||
|
['0', '0', '0']
|
||||||
|
];
|
||||||
|
$this->assertEquals($expectedRows, $allRows, 'There should be only 3 rows, because zeros (0) are valid values');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* https://github.com/box/spout/issues/184
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testReadShouldCreateOutputEmptyCellPreserved()
|
||||||
|
{
|
||||||
|
$allRows = $this->getAllRowsForFile('sheet_with_empty_cells.xlsx');
|
||||||
|
|
||||||
|
$expectedRows = [
|
||||||
|
['A', 'B', 'C'],
|
||||||
|
['0', '', ''],
|
||||||
|
['1', '1', '']
|
||||||
|
];
|
||||||
|
$this->assertEquals($expectedRows, $allRows, 'There should be 3 rows, with equal length');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $fileName
|
* @param string $fileName
|
||||||
* @return array All the read rows the given file
|
* @return array All the read rows the given file
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
"A","B","C"
|
||||||
|
0,,
|
||||||
|
1,1,
|
||||||
|
@@ -0,0 +1,3 @@
|
|||||||
|
"A","B","C"
|
||||||
|
1,2,3
|
||||||
|
0,0,0
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in new issue
Block a user