DictionarySpec::it_can_generates_random_values()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 8
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace spec\Knp\DictionaryBundle\Faker\Provider;
6
7
use Knp\DictionaryBundle\Dictionary;
8
use Knp\DictionaryBundle\Dictionary\Collection;
9
use Knp\DictionaryBundle\Faker;
10
use PhpSpec\ObjectBehavior;
11
12
final class DictionarySpec extends ObjectBehavior
13
{
14
    private Collection $dictionaries;
15
16
    function let()
17
    {
18
        $this->dictionaries = new Collection();
19
20
        $this->beConstructedWith($this->dictionaries);
21
    }
22
23
    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...
24
    {
25
        $this->shouldHaveType(Faker\Provider\Dictionary::class);
26
    }
27
28
    function it_can_generates_random_values(Dictionary $dictionary)
29
    {
30
        $dictionary->getName()->willReturn('the_dico');
31
        $dictionary->getKeys()->willReturn(['foo', 'bar', 'baz']);
32
33
        $this->dictionaries->add($dictionary->getWrappedObject());
0 ignored issues
show
Bug introduced by
The method getWrappedObject() does not exist on Knp\DictionaryBundle\Dictionary. ( Ignorable by Annotation )

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

33
        $this->dictionaries->add($dictionary->/** @scrutinizer ignore-call */ getWrappedObject());

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
34
35
        $this->dictionary('the_dico')->shouldBeOneOf('foo', 'bar', 'baz');
0 ignored issues
show
Bug introduced by
The method dictionary() does not exist on spec\Knp\DictionaryBundl...Provider\DictionarySpec. 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
               dictionary('the_dico')->shouldBeOneOf('foo', 'bar', 'baz');
Loading history...
36
    }
37
38
    function it_can_generates_unique_random_values(Dictionary $dictionary)
39
    {
40
        $dictionary->getName()->willReturn('the_dico');
41
        $dictionary->getKeys()->willReturn(['foo', 'bar', 'baz']);
42
43
        $this->dictionaries->add($dictionary->getWrappedObject());
44
45
        $this->unique()->dictionary('the_dico')->shouldBeOneOf('foo', 'bar', 'baz');
0 ignored issues
show
Bug introduced by
The method unique() does not exist on spec\Knp\DictionaryBundl...Provider\DictionarySpec. 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

45
        $this->/** @scrutinizer ignore-call */ 
46
               unique()->dictionary('the_dico')->shouldBeOneOf('foo', 'bar', 'baz');
Loading history...
46
    }
47
}
48