AggregateSpec   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 20
c 1
b 0
f 0
dl 0
loc 48
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A it_supports_values() 0 17 1
A it_is_a_value_transformer() 0 3 1
A it_is_initializable() 0 3 1
A it_transforms_value() 0 17 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace spec\Knp\DictionaryBundle\ValueTransformer;
6
7
use Knp\DictionaryBundle\ValueTransformer;
8
use Knp\DictionaryBundle\ValueTransformer\Aggregate;
9
use PhpSpec\ObjectBehavior;
10
11
final class AggregateSpec extends ObjectBehavior
12
{
13
    function it_is_initializable()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
14
    {
15
        $this->shouldHaveType(Aggregate::class);
16
    }
17
18
    function it_is_a_value_transformer()
19
    {
20
        $this->shouldHaveType(ValueTransformer::class);
21
    }
22
23
    function it_supports_values(
24
        ValueTransformer $transformer1,
25
        ValueTransformer $transformer2,
26
        ValueTransformer $transformer3
27
    ) {
28
        $transformer1->supports([])->willReturn(false);
29
        $transformer2->supports([])->willReturn(false);
30
        $transformer3->supports([])->willReturn(true);
31
32
        $this->addTransformer($transformer1);
0 ignored issues
show
Bug introduced by
The method addTransformer() does not exist on spec\Knp\DictionaryBundl...ansformer\AggregateSpec. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

32
        $this->/** @scrutinizer ignore-call */ 
33
               addTransformer($transformer1);
Loading history...
33
        $this->addTransformer($transformer2);
34
35
        $this->supports([])->shouldReturn(false);
0 ignored issues
show
Bug introduced by
The method supports() does not exist on spec\Knp\DictionaryBundl...ansformer\AggregateSpec. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

35
        $this->/** @scrutinizer ignore-call */ 
36
               supports([])->shouldReturn(false);
Loading history...
36
37
        $this->addTransformer($transformer3);
38
39
        $this->supports([])->shouldReturn(true);
40
    }
41
42
    function it_transforms_value(
43
        ValueTransformer $transformer1,
44
        ValueTransformer $transformer2,
45
        ValueTransformer $transformer3
46
    ) {
47
        $transformer1->supports([])->willReturn(false);
48
        $transformer2->supports([])->willReturn(true);
49
        $transformer3->supports([])->willReturn(true);
50
51
        $transformer2->transform([])->willReturn('foo');
52
        $transformer3->transform([])->willReturn('bar');
53
54
        $this->addTransformer($transformer1);
55
        $this->addTransformer($transformer2);
56
        $this->addTransformer($transformer3);
57
58
        $this->transform([])->shouldReturn('foo');
0 ignored issues
show
Bug introduced by
The method transform() does not exist on spec\Knp\DictionaryBundl...ansformer\AggregateSpec. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

58
        $this->/** @scrutinizer ignore-call */ 
59
               transform([])->shouldReturn('foo');
Loading history...
59
    }
60
}
61