Passed
Pull Request — master (#193)
by Pierre
02:59
created

DictionaryBehavior::it_is_a_dictionary()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace spec\Knp\DictionaryBundle\Dictionary;
6
7
use Knp\DictionaryBundle\Dictionary;
8
9
trait DictionaryBehavior
10
{
11
    public function it_is_a_dictionary(): void
12
    {
13
        $this
14
            ->shouldImplement(Dictionary::class)
0 ignored issues
show
Bug introduced by
It seems like shouldImplement() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

14
            ->/** @scrutinizer ignore-call */ 
15
              shouldImplement(Dictionary::class)
Loading history...
15
        ;
16
    }
17
18
    public function it_access_to_value_like_an_array(): void
19
    {
20
        foreach ($this->getExpectedResult() as $key => $value) {
21
            $this[$key]->shouldBe($value);
22
        }
23
    }
24
25
    public function it_provides_keys(): void
26
    {
27
        $this
28
            ->getKeys()
0 ignored issues
show
Bug introduced by
It seems like getKeys() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

28
            ->/** @scrutinizer ignore-call */ 
29
              getKeys()
Loading history...
29
            ->shouldReturn(array_keys($this->getExpectedResult()))
30
        ;
31
    }
32
33
    public function it_provides_values(): void
34
    {
35
        $this
36
            ->getValues()
0 ignored issues
show
Bug introduced by
It seems like getValues() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

36
            ->/** @scrutinizer ignore-call */ 
37
              getValues()
Loading history...
37
            ->shouldReturn(array_values($this->getExpectedResult()))
38
        ;
39
    }
40
41
    public function it_provides_combination_of_keys_and_values(): void
42
    {
43
        $this
44
            ->shouldYieldLike($this->getExpectedResult())
0 ignored issues
show
Bug introduced by
It seems like shouldYieldLike() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

44
            ->/** @scrutinizer ignore-call */ 
45
              shouldYieldLike($this->getExpectedResult())
Loading history...
45
        ;
46
    }
47
48
    public function it_is_countable(): void
49
    {
50
        $this
51
            ->shouldHaveCount(\count($this->getExpectedResult()))
0 ignored issues
show
Bug introduced by
It seems like shouldHaveCount() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

51
            ->/** @scrutinizer ignore-call */ 
52
              shouldHaveCount(\count($this->getExpectedResult()))
Loading history...
52
        ;
53
    }
54
55
    public function it_has_a_name(): void
56
    {
57
        $this
58
            ->getName()
0 ignored issues
show
Bug introduced by
It seems like getName() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

58
            ->/** @scrutinizer ignore-call */ 
59
              getName()
Loading history...
59
            ->shouldReturn($this->getExpectedName())
60
        ;
61
    }
62
63
    abstract protected function getExpectedResult(): array;
64
65
    abstract protected function getExpectedName(): string;
66
}
67