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

ProvidedHeaderStrategyTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getHeaders() 0 9 1
1
<?php
2
3
namespace SubjectivePHPTest\Csv;
4
5
use SplFileObject;
6
use SubjectivePHP\Csv\ProvidedHeaderStrategy;
7
use PHPUnit\Framework\TestCase;
8
9
/**
10
 * @coversDefaultClass \SubjectivePHP\Csv\ProvidedHeaderStrategy
11
 * @covers ::__construct
12
 */
13
final class ProvidedHeaderStrategyTest extends TestCase
14
{
15
    /**
16
     * @test
17
     * @covers ::getHeaders
18
     */
19
    public function getHeaders()
20
    {
21
        $headers = ['id', 'author', 'title', 'genre', 'price', 'publish_date', 'description'];
22
        $fileObject = new SplFileObject(__DIR__ . '/_files/basic.csv');
23
        $fileObject->setFlags(SplFileObject::READ_CSV);
24
        $fileObject->setCsvControl(',');
25
        $strategy = new ProvidedHeaderStrategy($headers);
26
        $this->assertSame($headers, $strategy->getHeaders($fileObject));
27
    }
28
}
29