Esempio n. 1
0
 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();
 }
Esempio n. 2
0
 /**
  * Test that column names prepended at first row
  * and values have been written at second line
  * if CsvWriter's 5-th parameter set to true
  *
  * @author  Igor Mukhin <*****@*****.**>
  */
 public function testHeaderPrependedWhenOptionSetToTrue()
 {
     $writer = new CsvWriter(';', '"', $this->getStream(), false, true);
     $writer->prepare();
     $writer->writeItem(array('col 1 name' => 'col 1 value', 'col 2 name' => 'col 2 value', 'col 3 name' => 'col 3 value'));
     # Column names should be at second line
     # Values should be at second line
     $this->assertContentsEquals("\"col 1 name\";\"col 2 name\";\"col 3 name\"\n" . "\"col 1 value\";\"col 2 value\";\"col 3 value\"\n", $writer);
     $writer->finish();
 }