Completed
Push — 1.0-adjust-cs ( dde5cf )
by Kamil
27:56
created

ProvinceSpec   A

Complexity

Total Complexity 12

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 12
lcom 0
cbo 1
dl 0
loc 66
rs 10
c 0
b 0
f 0

12 Methods

Rating   Name   Duplication   Size   Complexity  
A it_is_initializable() 0 4 1
A it_implements_Sylius_country_province_interface() 0 4 1
A it_implements_code_aware_interface() 0 4 1
A it_has_no_id_by_default() 0 4 1
A it_has_no_code_by_default() 0 4 1
A its_code_is_mutable() 0 5 1
A it_has_no_name_by_default() 0 4 1
A its_name_is_mutable() 0 5 1
A it_has_no_abbreviation_by_default() 0 4 1
A its_abbreviation_is_mutable() 0 5 1
A it_does_not_belong_to_country_by_default() 0 4 1
A it_allows_to_attach_itself_to_a_country() 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
declare(strict_types=1);
13
14
namespace spec\Sylius\Component\Addressing\Model;
15
16
use PhpSpec\ObjectBehavior;
17
use Sylius\Component\Addressing\Model\CountryInterface;
18
use Sylius\Component\Addressing\Model\Province;
19
use Sylius\Component\Addressing\Model\ProvinceInterface;
20
use Sylius\Component\Resource\Model\CodeAwareInterface;
21
22
/**
23
 * @author Paweł Jędrzejewski <[email protected]>
24
 */
25
final class ProvinceSpec extends ObjectBehavior
26
{
27
    function it_is_initializable(): void
28
    {
29
        $this->shouldHaveType(Province::class);
30
    }
31
32
    function it_implements_Sylius_country_province_interface(): void
0 ignored issues
show
Coding Style introduced by
function it_implements_S...ry_province_interface() does not seem to conform to the naming convention (^(?:(?:[a-z]|__)[a-zA-Z0-9]*|[a-z][a-z0-9_]*)$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
33
    {
34
        $this->shouldImplement(ProvinceInterface::class);
35
    }
36
37
    function it_implements_code_aware_interface(): void
38
    {
39
        $this->shouldImplement(CodeAwareInterface::class);
40
    }
41
42
    function it_has_no_id_by_default(): void
43
    {
44
        $this->getId()->shouldReturn(null);
45
    }
46
47
    function it_has_no_code_by_default(): void
48
    {
49
        $this->getCode()->shouldReturn(null);
50
    }
51
52
    function its_code_is_mutable(): void
53
    {
54
        $this->setCode('US-TX');
55
        $this->getCode()->shouldReturn('US-TX');
56
    }
57
58
    function it_has_no_name_by_default(): void
59
    {
60
        $this->getName()->shouldReturn(null);
61
    }
62
63
    function its_name_is_mutable(): void
64
    {
65
        $this->setName('Texas');
66
        $this->getName()->shouldReturn('Texas');
67
    }
68
69
    function it_has_no_abbreviation_by_default(): void
70
    {
71
        $this->getAbbreviation()->shouldReturn(null);
72
    }
73
74
    function its_abbreviation_is_mutable(): void
75
    {
76
        $this->setAbbreviation('TEX');
77
        $this->getAbbreviation()->shouldReturn('TEX');
78
    }
79
80
    function it_does_not_belong_to_country_by_default(): void
81
    {
82
        $this->getCountry()->shouldReturn(null);
83
    }
84
85
    function it_allows_to_attach_itself_to_a_country(CountryInterface $country): void
86
    {
87
        $this->setCountry($country);
88
        $this->getCountry()->shouldReturn($country);
89
    }
90
}
91