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 ( d32462...af31de )
by Hilari
05:14 queued 02:44
created

CacheBuilderSpec   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 4
c 2
b 0
f 0
lcom 0
cbo 2
dl 0
loc 49
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 4 1
A it_can_build_a_silent_cache() 0 9 1
A it_can_build_a_cache_with_logging() 0 9 1
A it_can_chain_caches() 0 21 1
1
<?php
2
3
namespace spec\Cmp\Cache\Factory;
4
5
use Cmp\Cache\Backend\ArrayCache;
6
use Cmp\Cache\Backend\ChainCache;
7
use Cmp\Cache\Backend\RedisCache;
8
use Cmp\Cache\Cache;
9
use Cmp\Cache\Factory\CacheFactoryInterface;
10
use PhpSpec\ObjectBehavior;
11
use Psr\Log\LoggerInterface;
12
use Psr\Log\LogLevel;
13
use Redis;
14
15
/**
16
 * Class CacheBuilderSpec
17
 *
18
 * @package spec\Cmp\Cache\Factory
19
 * @mixin \Cmp\Cache\Factory\CacheBuilder
20
 */
21
class CacheBuilderSpec extends ObjectBehavior
22
{
23
    function let(CacheFactoryInterface $factory)
24
    {
25
        $this->beConstructedWith($factory);
26
    }
27
28
    function it_can_build_a_silent_cache(CacheFactoryInterface $factory, Cache $cache)
29
    {
30
        $factory->arrayCache()->willReturn($cache);
31
        $factory->loggerCache($cache, false, null, LogLevel::ALERT)->willReturn($cache);
32
33
        $this->withoutExceptions()->shouldReturn($this);
34
35
        $this->build()->shouldBeAnInstanceOf($cache);
36
    }
37
38
    function it_can_build_a_cache_with_logging(CacheFactoryInterface $factory, Cache $cache, LoggerInterface $logger)
39
    {
40
        $factory->arrayCache()->willReturn($cache);
41
        $factory->loggerCache($cache, true, $logger, 'warning')->willReturn($cache);
42
43
        $this->withLogging($logger, 'warning')->shouldReturn($this);
44
45
        $this->build()->shouldBeAnInstanceOf($cache);
46
    }
47
48
    function it_can_chain_caches(
49
        CacheFactoryInterface $factory,
50
        ArrayCache $arrayCache,
51
        Redis $redis,
52
        Cache $anotherCache,
53
        RedisCache $redisOne,
54
        RedisCache $redisTwo,
55
        ChainCache $chainCache
56
    ) {
57
        $factory->arrayCache()->willReturn($arrayCache);
58
        $factory->redisCache($redis)->willReturn($redisOne);
59
        $factory->redisFromParams('host', 'port', 'db', 'timeout')->willReturn($redisTwo);
60
        $factory->chainCache([$arrayCache, $anotherCache, $redisOne, $redisTwo])->willReturn($chainCache);
61
62
        $this->withArrayCache()->shouldReturn($this);
63
        $this->withCache($anotherCache)->shouldReturn($this);
64
        $this->withRedis($redis)->shouldReturn($this);
65
        $this->withRedisCacheFromParams('host', 'port', 'db', 'timeout')->shouldReturn($this);
66
67
        $this->build()->shouldBeAnInstanceOf($chainCache);
68
    }
69
}
70