public function CsvEncoderTest::provideEncodeData in CSV Serialization 8
Same name and namespace in other branches
- 8.2 tests/src/Unit/CsvEncoderTest.php \Drupal\Tests\csv_serialization\Unit\CsvEncoderTest::provideEncodeData()
Provides data for testing the encoder.
Return value
array Am array of multi-dimensional arrays, to be converted to CSVs.
File
- tests/
src/ Unit/ CsvEncoderTest.php, line 33
Class
- CsvEncoderTest
- Tests the encoding and decoding functionality of CsvEncoder.
Namespace
Drupal\Tests\csv_serialization\UnitCode
public function provideEncodeData() {
$csv1_data = [
// Row 1.
[
'title' => 'This is title 1',
'body' => 'This is, body 1',
'images' => [
'img1.jpg',
],
'alias' => '',
'status' => 1,
],
// Row 2.
[
'title' => 'This is title 2',
'body' => '<p>This is, body 2</p>',
'images' => [
'img1.jpg',
'img2.jpg',
],
'alias' => '',
'status' => 0,
],
// Row 3.
[
'title' => 'This is title 3',
'body' => [
'<p>This is, body 3</p>',
],
'images' => [
[
'src' => 'img1.jpg',
'alt' => 'Image 1',
],
[
'src' => 'img2.jpg',
'alt' => 'Image, 2',
],
],
'alias' => '',
'status' => 0,
],
];
$csv1_encoded = trim(file_get_contents(__DIR__ . '/CsvEncoderTest.csv'));
return [
[
$csv1_data,
$csv1_encoded,
],
];
}