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
Pull Request — master (#2)
by Hilari
02:47
created

CacheBuilderSpec::it_can_chain_caches()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 21
rs 9.3142
cc 1
eloc 17
nc 1
nop 7
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