Completed
Push — scalar-types/customer ( 423d75 )
by Kamil
28:07 queued 05:34
created

CustomerSpec::it_has_unknown_gender_as_unknown()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 4
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
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
declare(strict_types=1);
13
14
namespace spec\Sylius\Component\Customer\Model;
15
16
use PhpSpec\ObjectBehavior;
17
use Sylius\Component\Customer\Model\Customer;
18
use Sylius\Component\Customer\Model\CustomerGroupInterface;
19
use Sylius\Component\Customer\Model\CustomerInterface;
20
21
/**
22
 * @author Michał Marcinkowski <[email protected]>
23
 * @author Grzegorz Sadowski <[email protected]>
24
 */
25
final class CustomerSpec extends ObjectBehavior
26
{
27
    function it_implements_customer_interface(): void
28
    {
29
        $this->shouldImplement(CustomerInterface::class);
30
    }
31
32
    function it_sets_email(): void
33
    {
34
        $this->setEmail('[email protected]');
35
36
        $this->getEmail()->shouldReturn('[email protected]');
37
    }
38
39
    function it_sets_first_name(): void
40
    {
41
        $this->setFirstName('Edward');
42
43
        $this->getFirstName()->shouldReturn('Edward');
44
    }
45
46
    function it_sets_last_name(): void
47
    {
48
        $this->setLastName('Thatch');
49
50
        $this->getLastName()->shouldReturn('Thatch');
51
    }
52
53
    function it_can_get_full_name(): void
54
    {
55
        $this->setFirstName('Edward');
56
        $this->setLastName('Kenway');
57
58
        $this->getFullName()->shouldReturn('Edward Kenway');
59
    }
60
61
    function it_sets_birthday(): void
62
    {
63
        $birthday = new \DateTime('1987-07-08');
64
        $this->setBirthday($birthday);
65
66
        $this->getBirthday()->shouldReturn($birthday);
67
    }
68
69
    function it_sets_gender(): void
70
    {
71
        $this->setGender(CustomerInterface::FEMALE_GENDER);
72
73
        $this->getGender()->shouldReturn(CustomerInterface::FEMALE_GENDER);
74
    }
75
76
    function it_has_unknown_gender_as_unknown(): void
77
    {
78
        $this->getGender()->shouldReturn(CustomerInterface::UNKNOWN_GENDER);
79
    }
80
81
    function it_can_check_if_gender_is_female(): void
82
    {
83
        $this->setGender(CustomerInterface::FEMALE_GENDER);
84
        $this->isFemale()->shouldReturn(true);
85
        $this->isMale()->shouldReturn(false);
86
    }
87
88
    function it_can_check_if_gender_is_male(): void
89
    {
90
        $this->setGender(CustomerInterface::MALE_GENDER);
91
        $this->isFemale()->shouldReturn(false);
92
        $this->isMale()->shouldReturn(true);
93
    }
94
95
    function it_has_no_group_by_default(): void
96
    {
97
        $this->getGroup()->shouldReturn(null);
98
    }
99
100
    function its_group_is_mutable(CustomerGroupInterface $group): void
101
    {
102
        $this->setGroup($group);
103
        $this->getGroup()->shouldReturn($group);
104
    }
105
}
106