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\Order\Model; |
13
|
|
|
|
14
|
|
|
use Doctrine\Common\Collections\Collection; |
15
|
|
|
use PhpSpec\ObjectBehavior; |
16
|
|
|
use Prophecy\Argument; |
17
|
|
|
use Sylius\Component\Order\Model\AdjustableInterface; |
18
|
|
|
use Sylius\Component\Order\Model\AdjustmentInterface; |
19
|
|
|
use Sylius\Component\Order\Model\Order; |
20
|
|
|
use Sylius\Component\Order\Model\OrderInterface; |
21
|
|
|
use Sylius\Component\Order\Model\OrderItemInterface; |
22
|
|
|
use Sylius\Component\Resource\Model\TimestampableInterface; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @author Paweł Jędrzejewski <[email protected]> |
26
|
|
|
*/ |
27
|
|
|
final class OrderSpec extends ObjectBehavior |
28
|
|
|
{ |
29
|
|
|
function it_is_initializable() |
30
|
|
|
{ |
31
|
|
|
$this->shouldHaveType(Order::class); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
function it_implements_an_order_interface() |
35
|
|
|
{ |
36
|
|
|
$this->shouldImplement(OrderInterface::class); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
function it_implements_an_adjustable_interface() |
40
|
|
|
{ |
41
|
|
|
$this->shouldImplement(AdjustableInterface::class); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
function it_implements_a_timestampable_interface() |
45
|
|
|
{ |
46
|
|
|
$this->shouldImplement(TimestampableInterface::class); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
function it_has_no_id_by_default() |
50
|
|
|
{ |
51
|
|
|
$this->getId()->shouldReturn(null); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
function it_does_not_have_completed_checkout_by_default() |
55
|
|
|
{ |
56
|
|
|
$this->shouldNotBeCheckoutCompleted(); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
function its_checkout_can_be_completed() |
60
|
|
|
{ |
61
|
|
|
$this->completeCheckout(); |
62
|
|
|
$this->shouldBeCheckoutCompleted(); |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
function it_has_checkout_completed_when_completion_date_is_set() |
66
|
|
|
{ |
67
|
|
|
$this->shouldNotBeCheckoutCompleted(); |
68
|
|
|
$this->setCheckoutCompletedAt(new \DateTime('2 days ago')); |
69
|
|
|
$this->shouldBeCheckoutCompleted(); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
function it_has_no_checkout_completion_date_by_default() |
73
|
|
|
{ |
74
|
|
|
$this->getCheckoutCompletedAt()->shouldReturn(null); |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
function its_checkout_completion_date_is_mutable() |
78
|
|
|
{ |
79
|
|
|
$date = new \DateTime('1 hour ago'); |
80
|
|
|
|
81
|
|
|
$this->setCheckoutCompletedAt($date); |
82
|
|
|
$this->getCheckoutCompletedAt()->shouldReturn($date); |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
function it_has_no_number_by_default() |
86
|
|
|
{ |
87
|
|
|
$this->getNumber()->shouldReturn(null); |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
function its_number_is_mutable() |
91
|
|
|
{ |
92
|
|
|
$this->setNumber('001351'); |
93
|
|
|
$this->getNumber()->shouldReturn('001351'); |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
function it_creates_items_collection_by_default() |
97
|
|
|
{ |
98
|
|
|
$this->getItems()->shouldHaveType(Collection::class); |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
function it_adds_items_properly(OrderItemInterface $item) |
102
|
|
|
{ |
103
|
|
|
$this->hasItem($item)->shouldReturn(false); |
104
|
|
|
|
105
|
|
|
$this->addItem($item); |
106
|
|
|
$this->hasItem($item)->shouldReturn(true); |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
function it_removes_items_properly(OrderItemInterface $item) |
110
|
|
|
{ |
111
|
|
|
$this->hasItem($item)->shouldReturn(false); |
112
|
|
|
|
113
|
|
|
$this->addItem($item); |
114
|
|
|
$this->hasItem($item)->shouldReturn(true); |
115
|
|
|
|
116
|
|
|
$this->removeItem($item); |
117
|
|
|
$this->hasItem($item)->shouldReturn(false); |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
function it_has_items_total_equal_to_0_by_default() |
121
|
|
|
{ |
122
|
|
|
$this->getItemsTotal()->shouldReturn(0); |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
function it_calculates_correct_items_total( |
126
|
|
|
OrderItemInterface $item1, |
127
|
|
|
OrderItemInterface $item2, |
128
|
|
|
OrderItemInterface $item3 |
129
|
|
|
) { |
130
|
|
|
$item1->getTotal()->willReturn(29999); |
131
|
|
|
$item2->getTotal()->willReturn(45000); |
132
|
|
|
$item3->getTotal()->willReturn(250); |
133
|
|
|
|
134
|
|
|
$item1->setOrder($this)->shouldBeCalled(); |
135
|
|
|
$item2->setOrder($this)->shouldBeCalled(); |
136
|
|
|
$item3->setOrder($this)->shouldBeCalled(); |
137
|
|
|
|
138
|
|
|
$item1->equals(Argument::any())->willReturn(false); |
139
|
|
|
$item2->equals(Argument::any())->willReturn(false); |
140
|
|
|
$item3->equals(Argument::any())->willReturn(false); |
141
|
|
|
|
142
|
|
|
$this->addItem($item1); |
143
|
|
|
$this->addItem($item2); |
144
|
|
|
$this->addItem($item3); |
145
|
|
|
|
146
|
|
|
$this->getItemsTotal()->shouldReturn(75249); |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
function it_creates_adjustments_collection_by_default() |
150
|
|
|
{ |
151
|
|
|
$this->getAdjustments()->shouldHaveType(Collection::class); |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
function it_adds_adjustments_properly(AdjustmentInterface $adjustment) |
155
|
|
|
{ |
156
|
|
|
$adjustment->setAdjustable($this)->shouldBeCalled(); |
157
|
|
|
$adjustment->isNeutral()->willReturn(true); |
158
|
|
|
|
159
|
|
|
$this->hasAdjustment($adjustment)->shouldReturn(false); |
160
|
|
|
$this->addAdjustment($adjustment); |
161
|
|
|
$this->hasAdjustment($adjustment)->shouldReturn(true); |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
function it_removes_adjustments_properly(AdjustmentInterface $adjustment) |
165
|
|
|
{ |
166
|
|
|
$this->hasAdjustment($adjustment)->shouldReturn(false); |
167
|
|
|
|
168
|
|
|
$adjustment->setAdjustable($this)->shouldBeCalled(); |
169
|
|
|
$adjustment->isNeutral()->willReturn(true); |
170
|
|
|
|
171
|
|
|
$this->addAdjustment($adjustment); |
172
|
|
|
$this->hasAdjustment($adjustment)->shouldReturn(true); |
173
|
|
|
|
174
|
|
|
$adjustment->isLocked()->willReturn(false); |
175
|
|
|
$adjustment->setAdjustable(null)->shouldBeCalled(); |
176
|
|
|
$this->removeAdjustment($adjustment); |
177
|
|
|
|
178
|
|
|
$this->hasAdjustment($adjustment)->shouldReturn(false); |
179
|
|
|
} |
180
|
|
|
|
181
|
|
|
function it_removes_adjustments_recursively_properly( |
182
|
|
|
AdjustmentInterface $orderAdjustment, |
183
|
|
|
OrderItemInterface $item |
184
|
|
|
) { |
185
|
|
|
$this->addAdjustment($orderAdjustment); |
186
|
|
|
$this->addItem($item); |
187
|
|
|
|
188
|
|
|
$item->removeAdjustmentsRecursively(null)->shouldBeCalled(); |
189
|
|
|
|
190
|
|
|
$this->removeAdjustmentsRecursively(); |
191
|
|
|
|
192
|
|
|
$this->hasAdjustment($orderAdjustment)->shouldReturn(false); |
193
|
|
|
} |
194
|
|
|
|
195
|
|
|
function it_removes_adjustments_recursively_by_type_properly( |
196
|
|
|
AdjustmentInterface $orderPromotionAdjustment, |
|
|
|
|
197
|
|
|
AdjustmentInterface $orderTaxAdjustment, |
198
|
|
|
OrderItemInterface $item |
199
|
|
|
) { |
200
|
|
|
$orderPromotionAdjustment->getType()->willReturn('promotion'); |
201
|
|
|
$orderPromotionAdjustment->isNeutral()->willReturn(true); |
202
|
|
|
$orderPromotionAdjustment->setAdjustable($this)->shouldBeCalled(); |
203
|
|
|
$orderPromotionAdjustment->isLocked()->willReturn(false); |
204
|
|
|
|
205
|
|
|
$orderTaxAdjustment->getType()->willReturn('tax'); |
206
|
|
|
$orderTaxAdjustment->isNeutral()->willReturn(true); |
207
|
|
|
$orderTaxAdjustment->setAdjustable($this)->shouldBeCalled(); |
208
|
|
|
$orderTaxAdjustment->isLocked()->willReturn(false); |
209
|
|
|
|
210
|
|
|
$this->addAdjustment($orderPromotionAdjustment); |
211
|
|
|
$this->addAdjustment($orderTaxAdjustment); |
212
|
|
|
$this->addItem($item); |
213
|
|
|
|
214
|
|
|
$item->removeAdjustmentsRecursively('tax')->shouldBeCalled(); |
215
|
|
|
$orderTaxAdjustment->setAdjustable(null)->shouldBeCalled(); |
216
|
|
|
|
217
|
|
|
$this->removeAdjustmentsRecursively('tax'); |
218
|
|
|
|
219
|
|
|
$this->hasAdjustment($orderPromotionAdjustment)->shouldReturn(true); |
220
|
|
|
$this->hasAdjustment($orderTaxAdjustment)->shouldReturn(false); |
221
|
|
|
} |
222
|
|
|
|
223
|
|
|
function it_returns_adjustments_recursively( |
224
|
|
|
AdjustmentInterface $orderAdjustment, |
225
|
|
|
AdjustmentInterface $itemAdjustment1, |
226
|
|
|
AdjustmentInterface $itemAdjustment2, |
227
|
|
|
OrderItemInterface $item1, |
228
|
|
|
OrderItemInterface $item2 |
229
|
|
|
) { |
230
|
|
|
$item1->setOrder($this)->shouldBeCalled(); |
231
|
|
|
$item1->getTotal()->willReturn(100); |
232
|
|
|
$item1->getAdjustmentsRecursively(null)->willReturn([$itemAdjustment1]); |
233
|
|
|
|
234
|
|
|
$item2->setOrder($this)->shouldBeCalled(); |
235
|
|
|
$item2->getTotal()->willReturn(100); |
236
|
|
|
$item2->getAdjustmentsRecursively(null)->willReturn([$itemAdjustment2]); |
237
|
|
|
|
238
|
|
|
$this->addItem($item1); |
239
|
|
|
$this->addItem($item2); |
240
|
|
|
|
241
|
|
|
$orderAdjustment->setAdjustable($this)->shouldBeCalled(); |
242
|
|
|
$orderAdjustment->isNeutral()->willReturn(true); |
243
|
|
|
|
244
|
|
|
$this->addAdjustment($orderAdjustment); |
245
|
|
|
|
246
|
|
|
$this->getAdjustmentsRecursively()->shouldReturn([$orderAdjustment, $itemAdjustment1, $itemAdjustment2]); |
247
|
|
|
} |
248
|
|
|
|
249
|
|
|
function it_has_adjustments_total_equal_to_0_by_default() |
250
|
|
|
{ |
251
|
|
|
$this->getAdjustmentsTotal()->shouldReturn(0); |
252
|
|
|
} |
253
|
|
|
|
254
|
|
|
function it_calculates_correct_adjustments_total( |
255
|
|
|
AdjustmentInterface $adjustment1, |
256
|
|
|
AdjustmentInterface $adjustment2, |
257
|
|
|
AdjustmentInterface $adjustment3 |
258
|
|
|
) { |
259
|
|
|
$adjustment1->getAmount()->willReturn(10000); |
260
|
|
|
$adjustment2->getAmount()->willReturn(-4999); |
261
|
|
|
$adjustment3->getAmount()->willReturn(1929); |
262
|
|
|
|
263
|
|
|
$adjustment1->isNeutral()->willReturn(false); |
264
|
|
|
$adjustment2->isNeutral()->willReturn(false); |
265
|
|
|
$adjustment3->isNeutral()->willReturn(false); |
266
|
|
|
|
267
|
|
|
$adjustment1->setAdjustable($this)->shouldBeCalled(); |
268
|
|
|
$adjustment2->setAdjustable($this)->shouldBeCalled(); |
269
|
|
|
$adjustment3->setAdjustable($this)->shouldBeCalled(); |
270
|
|
|
|
271
|
|
|
$this->addAdjustment($adjustment1); |
272
|
|
|
$this->addAdjustment($adjustment2); |
273
|
|
|
$this->addAdjustment($adjustment3); |
274
|
|
|
|
275
|
|
|
$this->getAdjustmentsTotal()->shouldReturn(6930); |
276
|
|
|
} |
277
|
|
|
|
278
|
|
|
function it_returns_adjustments_total_recursively( |
279
|
|
|
AdjustmentInterface $itemAdjustment, |
280
|
|
|
AdjustmentInterface $orderAdjustment, |
281
|
|
|
OrderItemInterface $orderItem |
282
|
|
|
) { |
283
|
|
|
$itemAdjustment->getAmount()->willReturn(10000); |
284
|
|
|
$orderAdjustment->getAmount()->willReturn(5000); |
285
|
|
|
|
286
|
|
|
$itemAdjustment->isNeutral()->willReturn(false); |
287
|
|
|
$orderAdjustment->isNeutral()->willReturn(false); |
288
|
|
|
|
289
|
|
|
$orderAdjustment->setAdjustable($this)->shouldBeCalled(); |
290
|
|
|
|
291
|
|
|
$orderItem->getAdjustmentsRecursively(null)->willReturn([$itemAdjustment]); |
292
|
|
|
$orderItem->setOrder($this)->shouldBeCalled(); |
293
|
|
|
$orderItem->getTotal()->willReturn(15000); |
294
|
|
|
|
295
|
|
|
$this->addItem($orderItem); |
296
|
|
|
$this->addAdjustment($orderAdjustment); |
297
|
|
|
|
298
|
|
|
$this->getAdjustmentsTotalRecursively()->shouldReturn(15000); |
299
|
|
|
} |
300
|
|
|
|
301
|
|
|
function it_has_total_equal_to_0_by_default() |
302
|
|
|
{ |
303
|
|
|
$this->getTotal()->shouldReturn(0); |
304
|
|
|
} |
305
|
|
|
|
306
|
|
|
function it_has_total_quantity(OrderItemInterface $orderItem1, OrderItemInterface $orderItem2) |
307
|
|
|
{ |
308
|
|
|
$orderItem1->getQuantity()->willReturn(10); |
309
|
|
|
$orderItem1->setOrder($this)->shouldBeCalled(); |
310
|
|
|
$orderItem1->getTotal()->willReturn(500); |
311
|
|
|
|
312
|
|
|
$orderItem2->getQuantity()->willReturn(30); |
313
|
|
|
$orderItem2->setOrder($this)->shouldBeCalled(); |
314
|
|
|
$orderItem2->equals($orderItem1)->willReturn(false); |
315
|
|
|
$orderItem2->getTotal()->willReturn(1000); |
316
|
|
|
|
317
|
|
|
$this->addItem($orderItem1); |
318
|
|
|
$this->addItem($orderItem2); |
319
|
|
|
|
320
|
|
|
$this->getTotalQuantity()->shouldReturn(40); |
321
|
|
|
} |
322
|
|
|
|
323
|
|
|
function it_calculates_correct_total( |
324
|
|
|
OrderItemInterface $item1, |
325
|
|
|
OrderItemInterface $item2, |
326
|
|
|
AdjustmentInterface $adjustment1, |
327
|
|
|
AdjustmentInterface $adjustment2 |
328
|
|
|
) { |
329
|
|
|
$item1->getTotal()->willReturn(29999); |
330
|
|
|
$item2->getTotal()->willReturn(45000); |
331
|
|
|
|
332
|
|
|
$item1->equals(Argument::any())->willReturn(false); |
333
|
|
|
$item2->equals(Argument::any())->willReturn(false); |
334
|
|
|
|
335
|
|
|
$item1->setOrder($this)->shouldBeCalled(); |
336
|
|
|
$item2->setOrder($this)->shouldBeCalled(); |
337
|
|
|
|
338
|
|
|
$adjustment1->isNeutral()->willReturn(false); |
339
|
|
|
$adjustment1->getAmount()->willReturn(10000); |
340
|
|
|
$adjustment2->isNeutral()->willReturn(false); |
341
|
|
|
$adjustment2->getAmount()->willReturn(-4999); |
342
|
|
|
|
343
|
|
|
$adjustment1->setAdjustable($this)->shouldBeCalled(); |
344
|
|
|
$adjustment2->setAdjustable($this)->shouldBeCalled(); |
345
|
|
|
|
346
|
|
|
$this->addItem($item1); |
347
|
|
|
$this->addItem($item2); |
348
|
|
|
$this->addAdjustment($adjustment1); |
349
|
|
|
$this->addAdjustment($adjustment2); |
350
|
|
|
|
351
|
|
|
$this->getTotal()->shouldReturn(80000); |
352
|
|
|
} |
353
|
|
|
|
354
|
|
|
function it_calculates_correct_total_after_items_and_adjustments_changes( |
355
|
|
|
AdjustmentInterface $adjustment1, |
356
|
|
|
AdjustmentInterface $adjustment2, |
357
|
|
|
OrderItemInterface $item1, |
358
|
|
|
OrderItemInterface $item2, |
359
|
|
|
OrderItemInterface $item3 |
360
|
|
|
) { |
361
|
|
|
$item1->getTotal()->willReturn(29999); |
362
|
|
|
$item2->getTotal()->willReturn(45000); |
363
|
|
|
|
364
|
|
|
$item1->equals(Argument::any())->willReturn(false); |
365
|
|
|
$item2->equals(Argument::any())->willReturn(false); |
366
|
|
|
|
367
|
|
|
$item1->setOrder($this)->shouldBeCalled(); |
368
|
|
|
$item2->setOrder($this)->shouldBeCalled(); |
369
|
|
|
|
370
|
|
|
$adjustment1->isNeutral()->willReturn(false); |
371
|
|
|
$adjustment1->getAmount()->willReturn(10000); |
372
|
|
|
$adjustment1->setAdjustable($this)->shouldBeCalled(); |
373
|
|
|
|
374
|
|
|
$this->addItem($item1); |
375
|
|
|
$this->addItem($item2); |
376
|
|
|
$this->addAdjustment($adjustment1); |
377
|
|
|
|
378
|
|
|
$this->getTotal()->shouldReturn(84999); |
379
|
|
|
|
380
|
|
|
$item2->setOrder(null)->shouldBeCalled(); |
381
|
|
|
|
382
|
|
|
$this->removeItem($item2); |
383
|
|
|
|
384
|
|
|
$adjustment1->setAdjustable(null)->shouldBeCalled(); |
385
|
|
|
$adjustment1->isLocked()->willReturn(false); |
386
|
|
|
|
387
|
|
|
$adjustment2->isNeutral()->willReturn(false); |
388
|
|
|
$adjustment2->getAmount()->willReturn(-4999); |
389
|
|
|
$adjustment2->setAdjustable($this)->shouldBeCalled(); |
390
|
|
|
|
391
|
|
|
$this->removeAdjustment($adjustment1); |
392
|
|
|
$this->addAdjustment($adjustment2); |
393
|
|
|
|
394
|
|
|
$item3->getTotal()->willReturn(55000); |
395
|
|
|
$item3->equals(Argument::any())->willReturn(false); |
396
|
|
|
$item3->setOrder($this)->shouldBeCalled(); |
397
|
|
|
|
398
|
|
|
$this->addItem($item3); |
399
|
|
|
|
400
|
|
|
$this->getTotal()->shouldReturn(80000); |
401
|
|
|
} |
402
|
|
|
|
403
|
|
|
function it_ignores_neutral_adjustments_when_calculating_total( |
404
|
|
|
OrderItemInterface $item1, |
405
|
|
|
OrderItemInterface $item2, |
406
|
|
|
AdjustmentInterface $adjustment1, |
407
|
|
|
AdjustmentInterface $adjustment2 |
408
|
|
|
) { |
409
|
|
|
$item1->getTotal()->willReturn(29999); |
410
|
|
|
$item2->getTotal()->willReturn(45000); |
411
|
|
|
|
412
|
|
|
$item1->equals(Argument::any())->willReturn(false); |
413
|
|
|
$item2->equals(Argument::any())->willReturn(false); |
414
|
|
|
|
415
|
|
|
$item1->setOrder($this)->shouldBeCalled(); |
416
|
|
|
$item2->setOrder($this)->shouldBeCalled(); |
417
|
|
|
|
418
|
|
|
$adjustment1->isNeutral()->willReturn(true); |
419
|
|
|
$adjustment1->getAmount()->willReturn(10000); |
420
|
|
|
$adjustment2->isNeutral()->willReturn(false); |
421
|
|
|
$adjustment2->getAmount()->willReturn(-4999); |
422
|
|
|
|
423
|
|
|
$adjustment1->setAdjustable($this)->shouldBeCalled(); |
424
|
|
|
$adjustment2->setAdjustable($this)->shouldBeCalled(); |
425
|
|
|
|
426
|
|
|
$this->addItem($item1); |
427
|
|
|
$this->addItem($item2); |
428
|
|
|
$this->addAdjustment($adjustment1); |
429
|
|
|
$this->addAdjustment($adjustment2); |
430
|
|
|
|
431
|
|
|
$this->getTotal()->shouldReturn(70000); |
432
|
|
|
} |
433
|
|
|
|
434
|
|
|
function it_calculates_correct_total_when_adjustment_is_bigger_than_cost( |
435
|
|
|
OrderItemInterface $item, |
436
|
|
|
AdjustmentInterface $adjustment |
437
|
|
|
) { |
438
|
|
|
$item->getTotal()->willReturn(45000); |
439
|
|
|
|
440
|
|
|
$item->equals(Argument::any())->willReturn(false); |
441
|
|
|
|
442
|
|
|
$item->setOrder($this)->shouldBeCalled(); |
443
|
|
|
|
444
|
|
|
$adjustment->isNeutral()->willReturn(false); |
445
|
|
|
$adjustment->getAmount()->willReturn(-100000); |
446
|
|
|
|
447
|
|
|
$adjustment->setAdjustable($this)->shouldBeCalled(); |
448
|
|
|
|
449
|
|
|
$this->addItem($item); |
450
|
|
|
$this->addAdjustment($adjustment); |
451
|
|
|
|
452
|
|
|
$this->getTotal()->shouldReturn(0); |
453
|
|
|
} |
454
|
|
|
|
455
|
|
|
function it_initializes_creation_date_by_default() |
456
|
|
|
{ |
457
|
|
|
$this->getCreatedAt()->shouldHaveType(\DateTime::class); |
458
|
|
|
} |
459
|
|
|
|
460
|
|
|
function it_has_no_last_update_date_by_default() |
461
|
|
|
{ |
462
|
|
|
$this->getUpdatedAt()->shouldReturn(null); |
463
|
|
|
} |
464
|
|
|
|
465
|
|
|
function it_is_empty_by_default() |
466
|
|
|
{ |
467
|
|
|
$this->countItems()->shouldReturn(0); |
468
|
|
|
$this->shouldBeEmpty(); |
469
|
|
|
} |
470
|
|
|
|
471
|
|
|
function it_clears_items(OrderItemInterface $item) |
472
|
|
|
{ |
473
|
|
|
$this->shouldBeEmpty(); |
474
|
|
|
$this->addItem($item); |
475
|
|
|
$this->countItems()->shouldReturn(1); |
476
|
|
|
$this->clearItems(); |
477
|
|
|
$this->shouldBeEmpty(); |
478
|
|
|
} |
479
|
|
|
|
480
|
|
|
function it_has_notes() |
481
|
|
|
{ |
482
|
|
|
$this->setNotes('something squishy'); |
483
|
|
|
$this->getNotes()->shouldReturn('something squishy'); |
484
|
|
|
} |
485
|
|
|
} |
486
|
|
|
|
Very long variable names usually make code harder to read. It is therefore recommended not to make variable names too verbose.