Passed
Branch master (6a00e9)
by David
02:22
created

SubscriptionMock::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Terox\SubscriptionBundle\Tests\Mock;
4
5
use Symfony\Component\Security\Core\User\UserInterface;
6
use Terox\SubscriptionBundle\Model\ProductInterface;
7
use Terox\SubscriptionBundle\Model\SubscriptionInterface;
8
9
class SubscriptionMock implements SubscriptionInterface
10
{
11
    private $user;
12
13
    private $startDate;
14
15
    private $endDate;
16
17
    private $product;
18
19
    private $active;
20
21
    private $autoRenewal;
22
23
    private $reason;
24
25
    private $strategy;
26
27
    public function __construct()
28
    {
29
        $this->setActive(false);
30
        $this->setAutoRenewal(false);
31
        $this->setUser(new UserMock());
32
        $this->setStrategy('end_last'); // By default, only in this mock
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function getUser()
39
    {
40
        return $this->user;
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46
    public function setUser(UserInterface $user)
47
    {
48
        $this->user = $user;
49
50
        return $this;
51
    }
52
53
    /**
54
     * {@inheritdoc}
55
     */
56
    public function getProduct()
57
    {
58
        return $this->product;
59
    }
60
61
    /**
62
     * {@inheritdoc}
63
     */
64
    public function setProduct(ProductInterface $product)
65
    {
66
        $this->product = $product;
67
68
        return $this;
69
    }
70
71
    /**
72
     * {@inheritdoc}
73
     */
74
    public function getStartDate()
75
    {
76
        return $this->startDate;
77
    }
78
79
    /**
80
     * {@inheritdoc}
81
     */
82
    public function setStartDate(\DateTimeImmutable $startDate)
83
    {
84
        $this->startDate = $startDate;
85
86
        return $this;
87
    }
88
89
    /**
90
     * {@inheritdoc}
91
     */
92
    public function getEndDate()
93
    {
94
        return $this->endDate;
95
    }
96
97
    /**
98
     * {@inheritdoc}
99
     */
100
    public function setEndDate($endDate)
101
    {
102
        $this->endDate = $endDate;
103
104
        return $this;
105
    }
106
107
    /**
108
     * @return mixed
109
     */
110
    public function getActive()
111
    {
112
        return $this->active;
113
    }
114
115
    /**
116
     * @param mixed $active
117
     *
118
     * @return SubscriptionMock
119
     */
120
    public function setActive($active)
121
    {
122
        $this->active = $active;
123
124
        return $this;
125
    }
126
127
    /**
128
     * @return mixed
129
     */
130
    public function getAutoRenewal()
131
    {
132
        return $this->autoRenewal;
133
    }
134
135
    /**
136
     * @param mixed $autoRenewal
137
     *
138
     * @return SubscriptionMock
139
     */
140
    public function setAutoRenewal($autoRenewal)
141
    {
142
        $this->autoRenewal = $autoRenewal;
143
144
        return $this;
145
    }
146
147
    /**
148
     * {@inheritdoc}
149
     */
150
    public function getReason()
151
    {
152
        return $this->reason;
153
    }
154
155
    /**
156
     * {@inheritdoc}
157
     */
158
    public function setReason($reason)
159
    {
160
        $this->reason = $reason;
161
162
        return $this;
163
    }
164
165
    /**
166
     * {@inheritdoc}
167
     */
168
    public function isActive()
169
    {
170
        return $this->active;
171
    }
172
173
    /**
174
     * {@inheritdoc}
175
     */
176
    public function activate()
177
    {
178
        $this->setActive(true);
179
180
        return $this;
181
    }
182
183
    /**
184
     * {@inheritdoc}
185
     */
186
    public function deactivate()
187
    {
188
        $this->setActive(false);
189
190
        return $this;
191
    }
192
193
    /**
194
     * {@inheritdoc}
195
     */
196
    public function isAutoRenewal()
197
    {
198
        return $this->autoRenewal;
199
    }
200
201
    /**
202
     * @param string $name
203
     *
204
     * @return SubscriptionInterface
205
     */
206
    public function setStrategy($name)
207
    {
208
        $this->strategy = $name;
209
210
        return $this;
211
    }
212
213
    /**
214
     * @return string
215
     */
216
    public function getStrategy()
217
    {
218
        return $this->strategy;
219
    }
220
}
221