Completed
Push — unused-definitions ( d9908f )
by Kamil
18:33
created

ChannelSpec   A

Complexity

Total Complexity 21

Size/Duplication

Total Lines 121
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 21
lcom 0
cbo 1
dl 0
loc 121
rs 10
c 0
b 0
f 0

21 Methods

Rating   Name   Duplication   Size   Complexity  
A it_is_initializable() 0 4 1
A it_implements_a_channel_interface() 0 4 1
A it_extends_a_channel() 0 4 1
A it_has_no_base_currency_by_default() 0 4 1
A its_base_currency_is_mutable() 0 5 1
A it_has_no_default_locale_by_default() 0 4 1
A its_default_locale_is_mutable() 0 5 1
A it_has_no_default_tax_zone_by_default() 0 4 1
A its_default_tax_zone_is_mutable() 0 5 1
A it_has_no_tax_calculation_strategy_by_default() 0 4 1
A its_tax_calculation_strategy_is_mutable() 0 5 1
A it_has_an_empty_collection_of_currencies_by_default() 0 5 1
A it_can_have_a_currency_added() 0 5 1
A it_can_have_a_currency_removed() 0 6 1
A it_has_an_empty_collection_of_locales_by_default() 0 5 1
A it_can_have_a_locale_added() 0 5 1
A it_can_have_a_locale_removed() 0 6 1
A it_has_no_theme_name_by_default() 0 4 1
A its_theme_name_is_mutable() 0 5 1
A it_has_no_contact_email_by_default() 0 4 1
A its_contact_email_is_mutable() 0 5 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\Core\Model;
13
14
use Doctrine\Common\Collections\Collection;
15
use PhpSpec\ObjectBehavior;
16
use Sylius\Component\Addressing\Model\ZoneInterface;
17
use Sylius\Component\Channel\Model\Channel as BaseChannel;
18
use Sylius\Component\Core\Model\Channel;
19
use Sylius\Component\Core\Model\ChannelInterface;
20
use Sylius\Component\Currency\Model\CurrencyInterface;
21
use Sylius\Component\Locale\Model\LocaleInterface;
22
23
/**
24
 * @author Grzegorz Sadowski <[email protected]>
25
 */
26
final class ChannelSpec extends ObjectBehavior
27
{
28
    function it_is_initializable()
29
    {
30
        $this->shouldHaveType(Channel::class);
31
    }
32
33
    function it_implements_a_channel_interface()
34
    {
35
        $this->shouldImplement(ChannelInterface::class);
36
    }
37
38
    function it_extends_a_channel()
39
    {
40
        $this->shouldHaveType(BaseChannel::class);
41
    }
42
43
    function it_has_no_base_currency_by_default()
44
    {
45
        $this->getBaseCurrency()->shouldReturn(null);
46
    }
47
48
    function its_base_currency_is_mutable(CurrencyInterface $baseCurrency)
49
    {
50
        $this->setBaseCurrency($baseCurrency);
51
        $this->getBaseCurrency()->shouldReturn($baseCurrency);
52
    }
53
54
    function it_has_no_default_locale_by_default()
55
    {
56
        $this->getDefaultLocale()->shouldReturn(null);
57
    }
58
59
    function its_default_locale_is_mutable(LocaleInterface $defaultLocale)
60
    {
61
        $this->setDefaultLocale($defaultLocale);
62
        $this->getDefaultLocale()->shouldReturn($defaultLocale);
63
    }
64
65
    function it_has_no_default_tax_zone_by_default()
66
    {
67
        $this->getDefaultTaxZone()->shouldReturn(null);
68
    }
69
70
    function its_default_tax_zone_is_mutable(ZoneInterface $defaultTaxZone)
71
    {
72
        $this->setDefaultTaxZone($defaultTaxZone);
73
        $this->getDefaultTaxZone()->shouldReturn($defaultTaxZone);
74
    }
75
76
    function it_has_no_tax_calculation_strategy_by_default()
77
    {
78
        $this->getTaxCalculationStrategy()->shouldReturn(null);
79
    }
80
81
    function its_tax_calculation_strategy_is_mutable($taxCalculationStrategy)
0 ignored issues
show
Comprehensibility Naming introduced by
The variable name $taxCalculationStrategy exceeds the maximum configured length of 20.

Very long variable names usually make code harder to read. It is therefore recommended not to make variable names too verbose.

Loading history...
82
    {
83
        $this->setTaxCalculationStrategy($taxCalculationStrategy);
84
        $this->getTaxCalculationStrategy()->shouldReturn($taxCalculationStrategy);
85
    }
86
87
    function it_has_an_empty_collection_of_currencies_by_default()
88
    {
89
        $this->getCurrencies()->shouldHaveType(Collection::class);
90
        $this->getCurrencies()->count()->shouldReturn(0);
91
    }
92
93
    function it_can_have_a_currency_added(CurrencyInterface $currency)
94
    {
95
        $this->addCurrency($currency);
96
        $this->hasCurrency($currency)->shouldReturn(true);
97
    }
98
99
    function it_can_have_a_currency_removed(CurrencyInterface $currency)
100
    {
101
        $this->addCurrency($currency);
102
        $this->removeCurrency($currency);
103
        $this->hasCurrency($currency)->shouldReturn(false);
104
    }
105
106
    function it_has_an_empty_collection_of_locales_by_default()
107
    {
108
        $this->getLocales()->shouldHaveType(Collection::class);
109
        $this->getLocales()->count()->shouldReturn(0);
110
    }
111
112
    function it_can_have_a_locale_added(LocaleInterface $locale)
113
    {
114
        $this->addLocale($locale);
115
        $this->hasLocale($locale)->shouldReturn(true);
116
    }
117
118
    function it_can_have_a_locale_removed(LocaleInterface $locale)
119
    {
120
        $this->addLocale($locale);
121
        $this->removeLocale($locale);
122
        $this->hasLocale($locale)->shouldReturn(false);
123
    }
124
125
    function it_has_no_theme_name_by_default()
126
    {
127
        $this->getThemeName()->shouldReturn(null);
128
    }
129
130
    function its_theme_name_is_mutable($themeName)
131
    {
132
        $this->setThemeName($themeName);
133
        $this->getThemeName()->shouldReturn($themeName);
134
    }
135
136
    function it_has_no_contact_email_by_default()
137
    {
138
        $this->getContactEmail()->shouldReturn(null);
139
    }
140
141
    function its_contact_email_is_mutable($contactEmail)
142
    {
143
        $this->setContactEmail($contactEmail);
144
        $this->getContactEmail()->shouldReturn($contactEmail);
145
    }
146
}
147