Completed
Push — master ( 6999e1...b703c9 )
by Kamil
23:47
created

LocaleSpec::it_can_set_enabled_value()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
nc 1
cc 1
eloc 7
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\Component\Locale\Model;
13
14
use PhpSpec\ObjectBehavior;
15
use Sylius\Component\Locale\Model\Locale;
16
use Sylius\Component\Locale\Model\LocaleInterface;
17
use Sylius\Component\Resource\Model\TimestampableInterface;
18
19
/**
20
 * @author Kamil Kokot <[email protected]>
21
 */
22
final class LocaleSpec extends ObjectBehavior
23
{
24
    function let()
25
    {
26
        \Locale::setDefault('en');
27
    }
28
29
    function it_is_initializable()
30
    {
31
        $this->shouldHaveType(Locale::class);
32
    }
33
34
    function it_implements_a_locale_interface()
35
    {
36
        $this->shouldImplement(LocaleInterface::class);
37
    }
38
39
    function it_is_timestampable()
40
    {
41
        $this->shouldImplement(TimestampableInterface::class);
42
    }
43
44
    function it_does_not_have_id_by_default()
45
    {
46
        $this->getId()->shouldReturn(null);
47
    }
48
49
    function it_has_no_code_by_default()
50
    {
51
        $this->getCode()->shouldReturn(null);
52
    }
53
54
    function its_code_is_mutable()
55
    {
56
        $this->setCode('de_DE');
57
        $this->getCode()->shouldReturn('de_DE');
58
    }
59
60
    function it_has_a_name()
61
    {
62
        $this->setCode('pl_PL');
63
        $this->getName()->shouldReturn('Polish (Poland)');
64
        $this->getName('es')->shouldReturn('polaco (Polonia)');
65
66
        $this->setCode('pl');
67
        $this->getName()->shouldReturn('Polish');
68
        $this->getName('es')->shouldReturn('polaco');
69
    }
70
71
    function it_returns_name_when_converted_to_string()
72
    {
73
        $this->setCode('pl_PL');
74
        $this->__toString()->shouldReturn('Polish (Poland)');
75
76
        $this->setCode('pl');
77
        $this->__toString()->shouldReturn('Polish');
78
    }
79
80
    function it_initializes_creation_date_by_default()
81
    {
82
        $this->getCreatedAt()->shouldHaveType(\DateTime::class);
83
    }
84
85
    function it_does_not_have_last_update_date_by_default()
86
    {
87
        $this->getUpdatedAt()->shouldReturn(null);
88
    }
89
}
90