Completed
Push — layout-caching ( bff40d...dc5564 )
by Kamil
67:32 queued 46:25
created

CookieStorageSpec::it_is_a_storage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
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\ResourceBundle\Storage;
13
14
use PhpSpec\ObjectBehavior;
15
use Sylius\Component\Resource\Storage\StorageInterface;
16
17
/**
18
 * @author Kamil Kokot <[email protected]>
19
 */
20
final class CookieStorageSpec extends ObjectBehavior
21
{
22
    function it_is_a_storage()
23
    {
24
        $this->shouldImplement(StorageInterface::class);
25
    }
26
27
    function it_does_not_have_a_named_value_if_it_was_not_set_previously()
28
    {
29
        $this->get('name')->shouldReturn(null);
30
        $this->has('name')->shouldReturn(false);
31
    }
32
33
    function it_stores_a_named_value()
34
    {
35
        $this->set('name', 'value');
36
37
        $this->get('name')->shouldReturn('value');
38
        $this->has('name')->shouldReturn(true);
39
    }
40
41
    function it_removes_a_stored_named_value()
42
    {
43
        $this->set('name', 'value');
44
        $this->remove('name');
45
46
        $this->get('name')->shouldReturn(null);
47
        $this->has('name')->shouldReturn(false);
48
    }
49
50
    function it_returns_default_value_if_none_found()
51
    {
52
        $this->get('name', 'default')->shouldReturn('default');
53
    }
54
55
    function it_returns_all_values()
56
    {
57
        $this->set('foo', 'bar');
58
        $this->set('buzz', 'lightyear');
59
60
        $this->all()->shouldReturn([
61
            'foo' => 'bar',
62
            'buzz' => 'lightyear',
63
        ]);
64
    }
65
}
66