Completed
Pull Request — master (#2)
by Саша
36:16 queued 06:11
created

CsvExtractorSpec::it_rewinds()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 6
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace spec\Extraload\Extractor;
4
5
use PhpSpec\ObjectBehavior;
6
7
class CsvExtractorSpec extends ObjectBehavior
8
{
9
    function let()
10
    {
11
        $this->beConstructedWith(new \SplFileObject(__DIR__.'/../../Fixture/extract.csv'));
12
    }
13
14
    function it_is_initializable()
15
    {
16
        $this->shouldHaveType('Extraload\Extractor\CsvExtractor');
17
    }
18
19
    function it_implements_extractor_interface()
20
    {
21
        $this->shouldImplement('Extraload\Extractor\ExtractorInterface');
22
    }
23
24
    function it_iterates_over_csv_rows()
25
    {
26
        $this->extract()->shouldReturn(['a1', 'b1', 'c1']);
27
        $this->extract()->shouldReturn(['a2', 'b2', 'c2']);
28
        $this->extract()->shouldReturn(['a3', 'b3', 'c3']);
29
    }
30
31
    function it_moves_over_csv_rows()
32
    {
33
        $this->current()->shouldReturn(['a1', 'b1', 'c1']);
34
        $this->next();
35
        $this->current()->shouldReturn(['a2', 'b2', 'c2']);
36
        $this->next();
37
        $this->current()->shouldReturn(['a3', 'b3', 'c3']);
38
    }
39
40
    function it_rewinds()
41
    {
42
        $this->extract()->shouldReturn(['a1', 'b1', 'c1']);
43
        $this->rewind();
44
        $this->extract()->shouldReturn(['a1', 'b1', 'c1']);
45
    }
46
}
47