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

Class ExternalCsvTest

tests/Datasource/ExternalCsvTest.php:11–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9use Psr\Log\NullLogger;
10
11class 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}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected