You are here

public function CsvEncoderTest::testEncodeCsv in CSV Serialization 8.2

Same name and namespace in other branches
  1. 8 tests/src/Unit/CsvEncoderTest.php \Drupal\Tests\csv_serialization\Unit\CsvEncoderTest::testEncodeCsv()

Tests the CSV output of the encoder.

@dataProvider provideEncodeData

Parameters

$csv_data:

$csv_encoded:

File

tests/src/Unit/CsvEncoderTest.php, line 131

Class

CsvEncoderTest
Tests the encoding and decoding functionality of CsvEncoder.

Namespace

Drupal\Tests\csv_serialization\Unit

Code

public function testEncodeCsv($csv_data, $csv_encoded) {

  // @todo Test passing in arguments to the constructor. E.g., $separator, $enclosure, strip_tags, etc.
  // Note that what we encode does not exactly represent the hierarchy of
  // the data passed in. This is because cells containing multi-dimensional
  // arrays are flattened. Thus, encode($input) != decode($output).
  $this
    ->assertEquals($csv_encoded, $this->encoder
    ->encode($csv_data, 'csv'));
}