25 lines
592 B
PHP
25 lines
592 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
declare(strict_types=1);
|
||
|
|
|
||
|
|
use Infrastructure\Adapters\Services\CsvGeneratorImpl;
|
||
|
|
|
||
|
|
describe('CsvGeneratorImpl', function () {
|
||
|
|
it('generates csv content correctly', function () {
|
||
|
|
// GIVEN
|
||
|
|
$generator = new CsvGeneratorImpl();
|
||
|
|
$header = ['id', 'name'];
|
||
|
|
$rows = [
|
||
|
|
['1', 'John Doe'],
|
||
|
|
['2', 'Jane Doe'],
|
||
|
|
];
|
||
|
|
|
||
|
|
// WHEN
|
||
|
|
$result = $generator->generate($header, $rows);
|
||
|
|
|
||
|
|
// THEN
|
||
|
|
$expected = "id;name\n1;\"John Doe\"\n2;\"Jane Doe\"\n";
|
||
|
|
expect($result)->toBe($expected);
|
||
|
|
});
|
||
|
|
});
|