Cell value objects (#383)

* first stab at cell objects, #182
* removed comment parameter, streamlined cell detection, more tests #182
* shorter constant names, missing isFormula() #182
* first batch of changes #182
* documentation #182
This commit is contained in:
madflow authored and Adrien Loison committed 2017-05-01 12:09:24 +02:00
1 parent 4e6db6a8a1
commit 4acd9ad087
6 files changed
+312 -18

No files matched your search

+14
View File
@@ -5,6 +5,7 @@ namespace Box\Spout\Writer\CSV;
use Box\Spout\TestUsingResource;
use Box\Spout\Common\Type;
use Box\Spout\Common\Helper\EncodingHelper;
use Box\Spout\Writer\Common\Cell;
use Box\Spout\Writer\WriterFactory;
/**
@@ -177,6 +178,19 @@ class WriterTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('#This is, a comma#,csv--12,csv--13', $writtenContent, 'The fields should be enclosed with #');
}
/**
* @return void
*/
public function testWriteShouldAcceptCellObjects()
{
$allRows = [
[new Cell('String Value'), new Cell(1)]
];
$writtenContent = $this->writeToCsvFileAndReturnWrittenContent($allRows, 'csv_with_cell_objects.csv');
$writtenContent = $this->trimWrittenContent($writtenContent);
$this->assertEquals('"String Value",1', $writtenContent);
}
/**
* @param array $allRows
* @param string $fileName