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

it_processes_etl_sequentially()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 9
rs 9.6666
c 1
b 0
f 1
cc 1
eloc 6
nc 1
nop 3
1
<?php
2
3
namespace spec\Extraload\Pipeline;
4
5
use PhpSpec\ObjectBehavior;
6
use Prophecy\Argument;
7
use Extraload\Extractor\ExtractorInterface;
8
use Extraload\Transformer\TransformerInterface;
9
use Extraload\Loader\LoaderInterface;
10
11
class DefaultPipelineSpec extends ObjectBehavior
12
{
13
    function let(ExtractorInterface $extractor, TransformerInterface $transformer, LoaderInterface $loader)
14
    {
15
        $this->beConstructedWith($extractor, $transformer, $loader);
16
    }
17
18
    function it_is_initializable()
19
    {
20
        $this->shouldHaveType('Extraload\Pipeline\DefaultPipeline');
21
    }
22
23
    function it_implements_pipeline_interface()
24
    {
25
        $this->shouldImplement('Extraload\Pipeline\PipelineInterface');
26
    }
27
28
    function it_does_not_transform_nor_load_if_no_data_extracted(ExtractorInterface $extractor, TransformerInterface $transformer, LoaderInterface $loader)
0 ignored issues
show
Unused Code introduced by
The parameter $transformer is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
29
    {
30
        $extractor->extract()->shouldBeCalled()->willReturn(null);
31
        $loader->flush()->shouldBeCalled();
32
33
        $this->process();
34
    }
35
36
    function it_processes_etl_sequentially(ExtractorInterface $extractor, TransformerInterface $transformer, LoaderInterface $loader)
37
    {
38
        $extractor->extract()->shouldBeCalled()->willReturn(['a1', 'b1', 'c1'], null);
39
        $transformer->transform(['a1', 'b1', 'c1'])->shouldBeCalled()->willReturn(['c1', 'b1', 'a1']);
40
        $loader->load(['c1', 'b1', 'a1'])->shouldBeCalled();
41
        $loader->flush()->shouldBeCalled();
42
43
        $this->process();
44
    }
45
}
46