Completed
Push — master ( 60f5be...0d3c0c )
by Kamil
24:02
created

it_gets_currency_from_session()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
nc 1
cc 1
eloc 3
nop 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\Component\Currency\Context;
13
14
use PhpSpec\ObjectBehavior;
15
use Sylius\Component\Currency\Context\CurrencyContextInterface;
16
use Sylius\Component\Storage\StorageInterface;
17
18
class CurrencyContextSpec extends ObjectBehavior
19
{
20
    function let(StorageInterface $storage)
21
    {
22
        $this->beConstructedWith($storage, 'EUR');
23
    }
24
25
    function it_is_initializable()
26
    {
27
        $this->shouldHaveType('Sylius\Component\Currency\Context\CurrencyContext');
28
    }
29
30
    function it_implements_Sylius_currency_context_interface()
31
    {
32
        $this->shouldImplement(CurrencyContextInterface::class);
33
    }
34
35
    function it_gets_default_currency_code()
36
    {
37
        $this->getDefaultCurrencyCode()->shouldReturn('EUR');
38
    }
39
40
    function it_gets_currency_code_from_session($storage)
41
    {
42
        $storage->getData(CurrencyContextInterface::STORAGE_KEY, 'EUR')->willReturn('RSD');
43
44
        $this->getCurrencyCode()->shouldReturn('RSD');
45
    }
46
47
    function it_sets_currency_code_to_session($storage)
48
    {
49
        $storage->setData(CurrencyContextInterface::STORAGE_KEY, 'PLN')->shouldBeCalled();
50
51
        $this->setCurrencyCode('PLN');
52
    }
53
}
54