| @@ 20-28 (lines=9) @@ | ||
| 17 | * @test |
|
| 18 | * @covers ::derive |
|
| 19 | */ |
|
| 20 | public function derive() |
|
| 21 | { |
|
| 22 | $fileObject = $this->getFileObject('pipe_delimited.txt', '|'); |
|
| 23 | $strategy = HeaderStrategy::derive(); |
|
| 24 | $this->assertSame( |
|
| 25 | ['id', 'author', 'title', 'genre', 'price', 'publish_date', 'description'], |
|
| 26 | $strategy->getHeaders($fileObject) |
|
| 27 | ); |
|
| 28 | } |
|
| 29 | ||
| 30 | /** |
|
| 31 | * @test |
|
| @@ 46-54 (lines=9) @@ | ||
| 43 | * @test |
|
| 44 | * @covers ::none |
|
| 45 | */ |
|
| 46 | public function none() |
|
| 47 | { |
|
| 48 | $fileObject = $this->getFileObject('no_headers.csv'); |
|
| 49 | $strategy = HeaderStrategy::none(); |
|
| 50 | $this->assertSame( |
|
| 51 | [0, 1, 2, 3, 4, 5, 6], |
|
| 52 | $strategy->getHeaders($fileObject) |
|
| 53 | ); |
|
| 54 | } |
|
| 55 | ||
| 56 | public function getFileObject(string $fileName, string $delimiter = ',') : SplFileObject |
|
| 57 | { |
|