|
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\Taxation\Model; |
|
13
|
|
|
|
|
14
|
|
|
use PhpSpec\ObjectBehavior; |
|
15
|
|
|
use Sylius\Component\Taxation\Model\TaxCategoryInterface; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* @author Paweł Jędrzejewski <[email protected]> |
|
19
|
|
|
*/ |
|
20
|
|
|
final class TaxCategorySpec extends ObjectBehavior |
|
21
|
|
|
{ |
|
22
|
|
|
function it_is_initializable() |
|
23
|
|
|
{ |
|
24
|
|
|
$this->shouldHaveType('Sylius\Component\Taxation\Model\TaxCategory'); |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
function it_should_implement_Sylius_tax_category_interface() |
|
|
|
|
|
|
28
|
|
|
{ |
|
29
|
|
|
$this->shouldImplement(TaxCategoryInterface::class); |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
function it_should_not_have_id_by_default() |
|
33
|
|
|
{ |
|
34
|
|
|
$this->getId()->shouldReturn(null); |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
function it_has_mutable_code() |
|
38
|
|
|
{ |
|
39
|
|
|
$this->setCode('TC1'); |
|
40
|
|
|
$this->getCode()->shouldReturn('TC1'); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
function it_should_be_unnamed_by_default() |
|
44
|
|
|
{ |
|
45
|
|
|
$this->getName()->shouldReturn(null); |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
function its_name_should_be_mutable() |
|
49
|
|
|
{ |
|
50
|
|
|
$this->setName('Taxable goods'); |
|
51
|
|
|
$this->getName()->shouldReturn('Taxable goods'); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
function it_should_not_have_description_by_default() |
|
55
|
|
|
{ |
|
56
|
|
|
$this->getDescription()->shouldReturn(null); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
function its_description_should_be_mutable() |
|
60
|
|
|
{ |
|
61
|
|
|
$this->setDescription('All taxable goods'); |
|
62
|
|
|
$this->getDescription()->shouldReturn('All taxable goods'); |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
function it_should_initialize_creation_date_by_default() |
|
66
|
|
|
{ |
|
67
|
|
|
$this->getCreatedAt()->shouldHaveType(\DateTime::class); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
function it_should_not_have_last_update_date_by_default() |
|
71
|
|
|
{ |
|
72
|
|
|
$this->getUpdatedAt()->shouldReturn(null); |
|
73
|
|
|
} |
|
74
|
|
|
} |
|
75
|
|
|
|
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.