| @@ 10-27 (lines=18) @@ | ||
| 7 | class LocalFileStorageTest extends \PHPUnit_Framework_TestCase |
|
| 8 | { |
|
| 9 | ||
| 10 | public function testCsv() |
|
| 11 | { |
|
| 12 | $format = new CsvFormat(';'); |
|
| 13 | $localFile = new LocalFileStorage(new \SplFileObject(__DIR__ . '/../../../../metadata/testfiles/flatdata.csv'), $format); |
|
| 14 | $reader = $localFile->reader(); |
|
| 15 | ||
| 16 | $info = $localFile->info(); |
|
| 17 | $this->assertEquals(new StorageInfo(array( |
|
| 18 | 'name' => 'flatdata.csv', |
|
| 19 | 'format' => $format, |
|
| 20 | 'size' => 32, |
|
| 21 | 'count' => 1, |
|
| 22 | 'hash' => '4f0e1e99eb12d94dc527fedce9eb58d8' |
|
| 23 | )), $info); |
|
| 24 | ||
| 25 | $headers = $reader->getColumnHeaders(); |
|
| 26 | $this->assertEquals(2, count($headers)); |
|
| 27 | } |
|
| 28 | ||
| 29 | public function testXls() |
|
| 30 | { |
|
| @@ 29-46 (lines=18) @@ | ||
| 26 | $this->assertEquals(2, count($headers)); |
|
| 27 | } |
|
| 28 | ||
| 29 | public function testXls() |
|
| 30 | { |
|
| 31 | $format = new ExcelFormat(); |
|
| 32 | $localFile = new LocalFileStorage(new \SplFileObject(__DIR__ . '/../../../../metadata/testfiles/flatdata-excel.xls'), $format); |
|
| 33 | $reader = $localFile->reader(); |
|
| 34 | ||
| 35 | $info = $localFile->info(); |
|
| 36 | $this->assertEquals(new StorageInfo(array( |
|
| 37 | 'name' => 'flatdata-excel.xls', |
|
| 38 | 'format' => $format, |
|
| 39 | 'size' => 23552, |
|
| 40 | 'count' => 1, |
|
| 41 | 'hash' => '3dbea55520f59ebdd08b6ad85ae95005' |
|
| 42 | )), $info); |
|
| 43 | ||
| 44 | $headers = $reader->getColumnHeaders(); |
|
| 45 | $this->assertEquals(2, count($headers)); |
|
| 46 | } |
|
| 47 | ||
| 48 | public function testXlsx() |
|
| 49 | { |
|
| @@ 48-65 (lines=18) @@ | ||
| 45 | $this->assertEquals(2, count($headers)); |
|
| 46 | } |
|
| 47 | ||
| 48 | public function testXlsx() |
|
| 49 | { |
|
| 50 | $format = new ExcelFormat(); |
|
| 51 | $localFile = new LocalFileStorage(new \SplFileObject(__DIR__ . '/../../../../metadata/testfiles/flatdata-excel-xml.xlsx'), $format); |
|
| 52 | $reader = $localFile->reader(); |
|
| 53 | ||
| 54 | $info = $localFile->info(); |
|
| 55 | $this->assertEquals(new StorageInfo(array( |
|
| 56 | 'name' => 'flatdata-excel-xml.xlsx', |
|
| 57 | 'format' => $format, |
|
| 58 | 'size' => 8895, |
|
| 59 | 'count' => 2, |
|
| 60 | 'hash' => 'b297aa9bbc37f9cd51d8472498772474' |
|
| 61 | )), $info); |
|
| 62 | ||
| 63 | $headers = $reader->getColumnHeaders(); |
|
| 64 | $this->assertEquals(2, count($headers)); |
|
| 65 | } |
|
| 66 | } |
|
| 67 | ||