Completed
Push — theme-bundle ( aad440...af4cdd )
by Kamil
15:45
created

TemplatePathsCacheClearerSpec   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 4 1
A it_is_initializable() 0 4 1
A it_implements_cache_clearer_interface() 0 4 1
A it_deletes_all_elements_if_cache_is_clearable() 0 6 1
A it_does_not_throw_any_error_if_cache_is_not_clearable() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace spec\Sylius\Bundle\ThemeBundle\Templating\Cache\Clearer;
13
14
use Doctrine\Common\Cache\Cache;
15
use Doctrine\Common\Cache\ClearableCache;
16
use PhpSpec\ObjectBehavior;
17
use Prophecy\Argument;
18
use Sylius\Bundle\ThemeBundle\Templating\Cache\Clearer\TemplatePathsCacheClearer;
19
use Symfony\Component\HttpKernel\CacheClearer\CacheClearerInterface;
20
21
/**
22
 * @mixin TemplatePathsCacheClearer
23
 *
24
 * @author Kamil Kokot <[email protected]>
25
 */
26
class TemplatePathsCacheClearerSpec extends ObjectBehavior
27
{
28
    function let(Cache $cache)
29
    {
30
        $this->beConstructedWith($cache);
31
    }
32
33
    function it_is_initializable()
34
    {
35
        $this->shouldHaveType('Sylius\Bundle\ThemeBundle\Templating\Cache\Clearer\TemplatePathsCacheClearer');
36
    }
37
38
    function it_implements_cache_clearer_interface()
39
    {
40
        $this->shouldImplement(CacheClearerInterface::class);
41
    }
42
43
    function it_deletes_all_elements_if_cache_is_clearable(ClearableCache $cache)
44
    {
45
        $cache->deleteAll()->shouldBeCalled();
46
47
        $this->clear(null);
48
    }
49
50
    function it_does_not_throw_any_error_if_cache_is_not_clearable()
51
    {
52
        $this->clear(null);
53
    }
54
}
55