Completed
Push — master ( e9a7f6...2665f3 )
by Kamil
46:03 queued 28:24
created

PaymentMethodSpec::its_position_is_mutable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
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
namespace spec\Sylius\Component\Payment\Model;
13
14
use PhpSpec\ObjectBehavior;
15
use Sylius\Component\Payment\Model\PaymentMethod;
16
use Sylius\Component\Payment\Model\PaymentMethodInterface;
17
18
/**
19
 * @author Paweł Jędrzejewski <[email protected]>
20
 */
21
final class PaymentMethodSpec extends ObjectBehavior
22
{
23
    public function let()
24
    {
25
        $this->setCurrentLocale('en_US');
26
        $this->setFallbackLocale('en_US');
27
    }
28
29
    function it_is_initializable()
30
    {
31
        $this->shouldHaveType(PaymentMethod::class);
32
    }
33
34
    function it_implements_sylius_payment_method_interface()
35
    {
36
        $this->shouldImplement(PaymentMethodInterface::class);
37
    }
38
39
    function it_has_no_id_by_default()
40
    {
41
        $this->getId()->shouldReturn(null);
42
    }
43
44
    function its_code_is_mutable()
45
    {
46
        $this->setCode('PM1');
47
        $this->getCode()->shouldReturn('PM1');
48
    }
49
50
    function it_is_unnamed_by_default()
51
    {
52
        $this->getName()->shouldReturn(null);
53
    }
54
55
    function its_name_is_mutable()
56
    {
57
        $this->setName('Stripe');
58
        $this->getName()->shouldReturn('Stripe');
59
    }
60
61
    function it_is_convertible_to_string_and_returns_its_name()
62
    {
63
        $this->setName('PayPal');
64
        $this->__toString()->shouldReturn('PayPal');
65
    }
66
67
    function it_has_no_description_by_default()
68
    {
69
        $this->getDescription()->shouldReturn(null);
70
    }
71
72
    function its_description_is_mutable()
73
    {
74
        $this->setDescription('Pay by check.');
75
        $this->getDescription()->shouldReturn('Pay by check.');
76
    }
77
78
    function its_instructions_is_mutable()
79
    {
80
        $this->setInstructions('Pay on account: 1100012312');
81
        $this->getInstructions()->shouldReturn('Pay on account: 1100012312');
82
    }
83
84
    function it_has_no_gateway_by_default()
85
    {
86
        $this->getGateway()->shouldReturn(null);
87
    }
88
89
    function its_gateway_is_mutable()
90
    {
91
        $this->setGateway('paypal');
92
        $this->getGateway()->shouldReturn('paypal');
93
    }
94
95
    function it_has_no_app_environment_by_default()
96
    {
97
        $this->getEnvironment()->shouldReturn(null);
98
    }
99
100
    function its_app_environment_is_mutable()
101
    {
102
        $this->setEnvironment('dev');
103
        $this->getEnvironment()->shouldReturn('dev');
104
    }
105
106
    function it_has_no_position_by_default()
107
    {
108
        $this->getPosition()->shouldReturn(null);
109
    }
110
111
    function its_position_is_mutable()
112
    {
113
        $this->setPosition(10);
114
        $this->getPosition()->shouldReturn(10);
115
    }
116
117
    function it_is_enabled_by_default()
118
    {
119
        $this->shouldBeEnabled();
120
    }
121
122
    function it_allows_disabling_itself()
123
    {
124
        $this->setEnabled(false);
125
        $this->shouldNotBeEnabled();
126
    }
127
128
    function it_initializes_creation_date_by_default()
129
    {
130
        $this->getCreatedAt()->shouldHaveType(\DateTime::class);
131
    }
132
133
    function it_has_no_last_update_date_by_default()
134
    {
135
        $this->getUpdatedAt()->shouldReturn(null);
136
    }
137
}
138