Code Duplication    Length = 18-18 lines in 2 locations

tests/DeriveHeaderStrategyTest.php 1 location

@@ 12-29 (lines=18) @@
9
/**
10
 * @coversDefaultClass \SubjectivePHP\Csv\DeriveHeaderStrategy
11
 */
12
final class DeriveHeaderStrategyTest extends TestCase
13
{
14
    /**
15
     * @test
16
     * @covers ::getHeaders
17
     */
18
    public function getHeaders()
19
    {
20
        $fileObject = new SplFileObject(__DIR__ . '/_files/pipe_delimited.txt');
21
        $fileObject->setFlags(SplFileObject::READ_CSV);
22
        $fileObject->setCsvControl('|');
23
        $strategy = new DeriveHeaderStrategy();
24
        $this->assertSame(
25
            ['id', 'author', 'title', 'genre', 'price', 'publish_date', 'description'],
26
            $strategy->getHeaders($fileObject)
27
        );
28
    }
29
}
30

tests/NoHeaderStrategyTest.php 1 location

@@ 12-29 (lines=18) @@
9
/**
10
 * @coversDefaultClass \SubjectivePHP\Csv\NoHeaderStrategy
11
 */
12
final class NoHeaderStrategyTest extends TestCase
13
{
14
    /**
15
     * @test
16
     * @covers ::getHeaders
17
     */
18
    public function getHeaders()
19
    {
20
        $fileObject = new SplFileObject(__DIR__ . '/_files/no_headers.csv');
21
        $fileObject->setFlags(SplFileObject::READ_CSV);
22
        $fileObject->setCsvControl(',');
23
        $strategy = new NoHeaderStrategy();
24
        $this->assertSame(
25
            [0, 1, 2, 3, 4, 5, 6],
26
            $strategy->getHeaders($fileObject)
27
        );
28
    }
29
}
30