ArrayCheckStepSpec   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 2
dl 0
loc 40
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A it_is_initializable() 0 4 1
A it_is_a_step() 0 4 1
A it_processes_an_item() 0 13 1
A it_throws_an_exception_when_item_is_invalid() 0 13 1
1
<?php
2
3
namespace spec\Port\Steps\Step;
4
5
use Port\Steps\Step;
6
use PhpSpec\ObjectBehavior;
7
8
class ArrayCheckStepSpec extends ObjectBehavior
9
{
10
    function it_is_initializable()
11
    {
12
        $this->shouldHaveType('Port\Steps\Step\ArrayCheckStep');
13
    }
14
15
    function it_is_a_step()
16
    {
17
        $this->shouldHaveType('Port\Steps\Step');
18
    }
19
20
    function it_processes_an_item(Step $step)
21
    {
22
        $next = function() {};
23
        $item = [];
24
        $step->process($item, $next)->willReturn(true);
25
26
        $this->process(
0 ignored issues
show
Bug introduced by
The method process() does not exist on spec\Port\Steps\Step\ArrayCheckStepSpec. Did you maybe mean it_processes_an_item()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
27
            $item,
28
            function($item) use ($step, $next) {
29
                return $step->process($item, $next);
30
            }
31
        );
32
    }
33
34
    function it_throws_an_exception_when_item_is_invalid(Step $step)
35
    {
36
        $next = function() {};
37
        $item = 'string';
38
        $step->process($item, $next)->shouldNotBeCalled();
39
40
        $this->shouldThrow('Port\Exception\UnexpectedTypeException')->duringProcess(
41
            $item,
42
            function($item) use ($step, $next) {
43
                return $step->process($item, $next);
44
            }
45
        );
46
    }
47
}
48