Skip to content

Commit

Permalink
Add Test for UTF-8 encoding to CsvWriter
Browse files Browse the repository at this point in the history
  • Loading branch information
mRoca committed Jul 28, 2014
1 parent 467dfac commit bb09dfc
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/Ddeboer/DataImport/Tests/Writer/CsvWriterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public function testWriteItem()
{
$writer = new CsvWriter(';', '"', $this->getStream());

$writer->prepare();
$writer->writeItem(array('first', 'last'));

$writer
Expand All @@ -29,6 +30,21 @@ public function testWriteItem()
$writer->finish();
}

public function testWriteUtf8Item()
{
$writer = new CsvWriter(';', '"', $this->getStream(), true);

$writer->prepare();
$writer->writeItem(array('Précédent', 'Suivant'));

$this->assertContentsEquals(
chr(0xEF) . chr(0xBB) . chr(0xBF) . "Précédent;Suivant\n",
$writer
);

$writer->finish();
}

public function testFluentInterface()
{
$writer = new CsvWriter(';', '"', $this->getStream());
Expand Down

0 comments on commit bb09dfc

Please sign in to comment.