| 9 | use Psr\Log\NullLogger; |
| 10 | |
| 11 | class ExternalCsvTest extends TestCase |
| 12 | { |
| 13 | private ExternalCsv $csv; |
| 14 | |
| 15 | protected function setUp(): void |
| 16 | { |
| 17 | $variableService = $this->createMock(VariableService::class); |
| 18 | $httpClient = $this->createMock(ExternalHttpClient::class); |
| 19 | $this->csv = new ExternalCsv('uid', new FakeL10N(), new NullLogger(), $variableService, $httpClient); |
| 20 | } |
| 21 | |
| 22 | /** |
| 23 | * @dataProvider delimiterProvider |
| 24 | */ |
| 25 | public function testDetectDelimiter(string $row, string $expected): void |
| 26 | { |
| 27 | $ref = new \ReflectionMethod(ExternalCsv::class, 'detectDelimiter'); |
| 28 | $this->assertSame($expected, $ref->invoke($this->csv, $row)); |
| 29 | } |
| 30 | |
| 31 | public function delimiterProvider(): array |
| 32 | { |
| 33 | return [ |
| 34 | ['a,b,c', ','], |
| 35 | ['a;b;c', ';'], |
| 36 | ['a|b|c', '|'], |
| 37 | ["a\tb\tc", "\t"], |
| 38 | ]; |
| 39 | } |
| 40 | } |
nothing calls this directly
no outgoing calls
no test coverage detected