PriorityListSpec::it_is_initializable()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 1
c 1
b 0
f 1
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * This file is part of slick/configuration
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace spec\Slick\Configuration\Common;
11
12
use Slick\Configuration\Common\PriorityList;
13
use PhpSpec\ObjectBehavior;
14
use Slick\Configuration\ConfigurationInterface;
15
16
/**
17
 * PriorityListSpec specs
18
 *
19
 * @package spec\Slick\Configuration\Common
20
 */
21
class PriorityListSpec extends ObjectBehavior
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(PriorityList::class);
26
    }
27
28
    function it_can_be_used_as_an_array()
29
    {
30
        $this->shouldBeAnInstanceOf(\ArrayAccess::class);
31
    }
32
33
    function its_an_iterable()
34
    {
35
        $this->shouldImplement(\IteratorAggregate::class);
36
    }
37
38
    function it_can_insert_objects(ConfigurationInterface $driver)
39
    {
40
        $this->insert($driver, 10)->shouldBe($this->getWrappedObject());
0 ignored issues
show
Bug introduced by
The method insert() does not exist on spec\Slick\Configuration\Common\PriorityListSpec. 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

40
        $this->/** @scrutinizer ignore-call */ 
41
               insert($driver, 10)->shouldBe($this->getWrappedObject());
Loading history...
41
    }
42
43
    function it_can_be_converted_to_array()
44
    {
45
        $this->asArray()->shouldBeArray();
0 ignored issues
show
Bug introduced by
The method asArray() does not exist on spec\Slick\Configuration\Common\PriorityListSpec. 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
               asArray()->shouldBeArray();
Loading history...
46
    }
47
48
    function it_adds_elements_with_a_given_priority(
49
        ConfigurationInterface $driver1,
50
        ConfigurationInterface $driver2,
51
        ConfigurationInterface $driver3,
52
    ) {
53
54
        $this->insert($driver1, 10)
55
            ->insert($driver2, 20)
56
            ->insert($driver3, 15);
57
        $array = $this->asArray();
58
        $array[2]->shouldBe($driver2);
59
    }
60
61
    function it_can_be_counted(
62
        ConfigurationInterface $driver1,
63
        ConfigurationInterface $driver2,
64
        ConfigurationInterface $driver3
65
    ) {
66
        $this->insert($driver1, 10)
67
            ->insert($driver2, 20)
68
            ->insert($driver3, 15);
69
        $this->shouldBeAnInstanceOf(\Countable::class);
70
        $this->count()->shouldBe(3);
0 ignored issues
show
Bug introduced by
The method count() does not exist on spec\Slick\Configuration\Common\PriorityListSpec. 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

70
        $this->/** @scrutinizer ignore-call */ 
71
               count()->shouldBe(3);
Loading history...
71
    }
72
}
73