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 ( ba7cd4...25ae2a )
by Hilari
04:31
created

FeatureContext   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 61
wmc 6
lcom 2
cbo 1
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A theCacheIsEmpty() 0 4 1
A iStoreAAnItemInTheCache() 0 4 1
A whenIRetrieved() 0 4 1
A iShouldGetTheSameItem() 0 6 2
1
<?php
2
3
namespace Cmp\Cache\Tests;
4
5
use Behat\Behat\Context\SnippetAcceptingContext;
6
use Cmp\Cache\Infrastructure\RedisCache;
7
8
class FeatureContext implements SnippetAcceptingContext
9
{
10
    /**
11
     * @var \Redis
12
     */
13
    private $redis;
14
15
    /**
16
     * @var RedisCache
17
     */
18
    private $backend;
19
20
    /**
21
     * @var string
22
     */
23
    private $result;
24
25
    /**
26
     * FeatureContext constructor.
27
     */
28
    public function __construct()
29
    {
30
        $this->redis = new \Redis();
31
        $this->redis->connect('redis', 6379);
32
        $this->backend = new RedisCache($this->redis); 
33
    }
34
35
    /**
36
     * @Given The cache is empty
37
     */
38
    public function theCacheIsEmpty()
39
    {
40
        $this->redis->flushDB();
41
    }
42
43
    /**
44
     * @Given I store a an item in the cache
45
     */
46
    public function iStoreAAnItemInTheCache()
47
    {
48
        $this->backend->set('foo', 'bar');
49
    }
50
51
    /**
52
     * @When I retrieve it
53
     */
54
    public function whenIRetrieved()
55
    {
56
        $this->result = $this->backend->get('foo');
0 ignored issues
show
Documentation Bug introduced by
The property $result was declared of type string, but $this->backend->get('foo') is of type boolean. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
57
    }
58
59
    /**
60
     * @Then I should get the same item
61
     */
62
    public function iShouldGetTheSameItem()
63
    {
64
        if ($this->result !== 'bar') {
65
            throw new \RuntimeException("The retrieve item is not the same");
66
        }
67
    }
68
}