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
|
|
|
final class ProvinceSpec extends ObjectBehavior |
23
|
|
|
{ |
24
|
|
|
function it_is_initializable(): void |
25
|
|
|
{ |
26
|
|
|
$this->shouldHaveType(Province::class); |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
function it_implements_Sylius_country_province_interface(): void |
|
|
|
|
30
|
|
|
{ |
31
|
|
|
$this->shouldImplement(ProvinceInterface::class); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
function it_implements_code_aware_interface(): void |
35
|
|
|
{ |
36
|
|
|
$this->shouldImplement(CodeAwareInterface::class); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
function it_has_no_id_by_default(): void |
40
|
|
|
{ |
41
|
|
|
$this->getId()->shouldReturn(null); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
function it_has_no_code_by_default(): void |
45
|
|
|
{ |
46
|
|
|
$this->getCode()->shouldReturn(null); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
function its_code_is_mutable(): void |
50
|
|
|
{ |
51
|
|
|
$this->setCode('US-TX'); |
52
|
|
|
$this->getCode()->shouldReturn('US-TX'); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
function it_has_no_name_by_default(): void |
56
|
|
|
{ |
57
|
|
|
$this->getName()->shouldReturn(null); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
function its_name_is_mutable(): void |
61
|
|
|
{ |
62
|
|
|
$this->setName('Texas'); |
63
|
|
|
$this->getName()->shouldReturn('Texas'); |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
function it_has_no_abbreviation_by_default(): void |
67
|
|
|
{ |
68
|
|
|
$this->getAbbreviation()->shouldReturn(null); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
function its_abbreviation_is_mutable(): void |
72
|
|
|
{ |
73
|
|
|
$this->setAbbreviation('TEX'); |
74
|
|
|
$this->getAbbreviation()->shouldReturn('TEX'); |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
function it_does_not_belong_to_country_by_default(): void |
78
|
|
|
{ |
79
|
|
|
$this->getCountry()->shouldReturn(null); |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
function it_allows_to_attach_itself_to_a_country(CountryInterface $country): void |
83
|
|
|
{ |
84
|
|
|
$this->setCountry($country); |
85
|
|
|
$this->getCountry()->shouldReturn($country); |
86
|
|
|
} |
87
|
|
|
} |
88
|
|
|
|
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.