Support all ODS cell types

Including:
- date / time
- currency
- percentage
- void

And improved support for boolean
This commit is contained in:
Adrien Loison committed 2015-09-02 14:03:38 -07:00
1 parent aa7978146f
commit 818ec2488c
8 files changed
+112 -34

No files matched your search

+17
View File
@@ -143,6 +143,9 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
*/
public function testReadShouldSupportAllCellTypes()
{
$utcTz = new \DateTimeZone('UTC');
$honoluluTz = new \DateTimeZone('Pacific/Honolulu'); // UTC-10
$allRows = $this->getAllRowsForFile('sheet_with_all_cell_types.ods');
$expectedRows = [
@@ -150,6 +153,11 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
'ods--11', 'ods--12',
true, false,
0, 10.43,
new \DateTime('1987-11-29T00:00:00', $utcTz), new \DateTime('1987-11-29T13:37:00', $utcTz),
new \DateTime('1987-11-29T13:37:00', $utcTz), new \DateTime('1987-11-29T13:37:00', $honoluluTz),
new \DateInterval('PT13H37M00S'),
0, 0.42,
'42 USD', '9.99 EUR',
'',
],
];
@@ -165,6 +173,15 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
$this->assertEquals([['ods--11', '', 'ods--13']], $allRows);
}
/**
* @return void
*/
public function testReadShouldReturnNullOnInvalidDateOrTime()
{
$allRows = $this->getAllRowsForFile('sheet_with_invalid_date_time.ods');
$this->assertEquals([[null, null]], $allRows);
}
/**
* @return void
*/