MCPcopy Create free account
hub / github.com/Rello/analytics / ExternalCsvTest

Class ExternalCsvTest

tests/Datasource/ExternalCsvTest.php:10–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected