Completed
Pull Request — master (#31)
by Chad
01:30
created

DeriveHeaderStrategyTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 18
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getHeaders() 0 11 1
1
<?php
2
3
namespace SubjectivePHPTest\Csv;
4
5
use SplFileObject;
6
use SubjectivePHP\Csv\DeriveHeaderStrategy;
7
use PHPUnit\Framework\TestCase;
8
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