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

DefaultPipelineSpec   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 5
lcom 0
cbo 4
dl 0
loc 35
rs 10
c 1
b 0
f 1

5 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 4 1
A it_is_initializable() 0 4 1
A it_implements_pipeline_interface() 0 4 1
A it_does_not_transform_nor_load_if_no_data_extracted() 0 7 1
A it_processes_etl_sequentially() 0 9 1
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