GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 2f12c3...e53ef5 )
by Hilari
02:46
created

TestCacheDecoratorSpec   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 68
Duplicated Lines 23.53 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 8
c 1
b 0
f 0
lcom 0
cbo 2
dl 16
loc 68
rs 10

8 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 4 1
A it_is_initializable() 0 4 1
A it_can_register_a_set_operation() 0 10 1
A it_can_register_a_has_operation() 0 8 1
A it_can_register_a_get_operation() 8 8 1
A it_can_register_a_demand_operation() 8 8 1
A it_can_register_a_delete_operation() 0 8 1
A it_can_register_a_flush_operation() 0 8 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace spec\Cmp\Cache\Application;
4
5
use Cmp\Cache\Domain\Cache;
6
use PhpSpec\ObjectBehavior;
7
8
/**
9
 * Class TestCacheDecoratorSpec
10
 *
11
 * @package spec\Cmp\Cache\Application
12
 * @mixin \Cmp\Cache\Application\TestCacheDecorator
13
 */
14
class TestCacheDecoratorSpec extends ObjectBehavior
15
{
16
    function let(Cache $decorated)
17
    {
18
        $this->beConstructedWith($decorated);
19
    }
20
21
    function it_is_initializable()
22
    {
23
        $this->shouldHaveType('\Cmp\Cache\Application\TestCacheDecorator');
24
    }
25
26
    function it_can_register_a_set_operation(Cache $decorated)
27
    {
28
        $this->hasBeenSet('foo', 'bar', 10)->shouldBe(false);
29
        $this->set('foo', 'bar', 10);
30
31
        $this->hasBeenSet('foo', 'bar', 10)->shouldBe(true);
32
        $this->hasBeenSet('foo', 'bar', 1)->shouldBe(false);
33
        $this->hasBeenSet('foo', 'nope')->shouldBe(false);
34
        $decorated->set('foo', 'bar', 10)->shouldHaveBeenCalled();
35
    }
36
37
    function it_can_register_a_has_operation(Cache $decorated)
38
    {
39
        $decorated->has('foo')->willReturn(true);
40
41
        $this->hasBeenChecked('foo')->shouldBe(false);
42
        $this->has('foo')->shouldReturn(true);
43
        $this->hasBeenChecked('foo')->shouldBe(true);
44
    }
45
46 View Code Duplication
    function it_can_register_a_get_operation(Cache $decorated)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
47
    {
48
        $decorated->get('foo', 'default')->willReturn('bar');
49
50
        $this->hasBeenGet('foo')->shouldBe(false);
51
        $this->get('foo', 'default')->shouldReturn('bar');
52
        $this->hasBeenGet('foo')->shouldBe(true);
53
    }
54
55 View Code Duplication
    function it_can_register_a_demand_operation(Cache $decorated)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
56
    {
57
        $decorated->demand('foo')->willReturn('bar');
58
59
        $this->hasBeenDemanded('foo')->shouldBe(false);
60
        $this->demand('foo')->shouldReturn('bar');
61
        $this->hasBeenDemanded('foo')->shouldBe(true);
62
    }
63
64
    function it_can_register_a_delete_operation(Cache $decorated)
65
    {
66
        $this->hasBeenDeleted('foo')->shouldBe(false);
67
        $this->delete('foo');
68
69
        $this->hasBeenDeleted('foo')->shouldBe(true);
70
        $decorated->delete('foo')->shouldHaveBeenCalled(true);
71
    }
72
73
    function it_can_register_a_flush_operation(Cache $decorated)
74
    {
75
        $this->hasBeenFlushed()->shouldBe(false);
76
        $this->flush();
77
78
        $this->hasBeenFlushed()->shouldBe(true);
79
        $decorated->flush()->shouldHaveBeenCalled(true);
80
    }
81
}
82