|
@@ 343-368 (lines=26) @@
|
| 340 |
|
$this->getTotalQuantity()->shouldReturn(40); |
| 341 |
|
} |
| 342 |
|
|
| 343 |
|
function it_calculates_correct_total(OrderItemInterface $item1, OrderItemInterface $item2, AdjustmentInterface $adjustment1, AdjustmentInterface $adjustment2) |
| 344 |
|
{ |
| 345 |
|
$item1->getTotal()->willReturn(29999); |
| 346 |
|
$item2->getTotal()->willReturn(45000); |
| 347 |
|
|
| 348 |
|
$item1->equals(Argument::any())->willReturn(false); |
| 349 |
|
$item2->equals(Argument::any())->willReturn(false); |
| 350 |
|
|
| 351 |
|
$item1->setOrder($this)->shouldBeCalled(); |
| 352 |
|
$item2->setOrder($this)->shouldBeCalled(); |
| 353 |
|
|
| 354 |
|
$adjustment1->isNeutral()->willReturn(false); |
| 355 |
|
$adjustment1->getAmount()->willReturn(10000); |
| 356 |
|
$adjustment2->isNeutral()->willReturn(false); |
| 357 |
|
$adjustment2->getAmount()->willReturn(-4999); |
| 358 |
|
|
| 359 |
|
$adjustment1->setAdjustable($this)->shouldBeCalled(); |
| 360 |
|
$adjustment2->setAdjustable($this)->shouldBeCalled(); |
| 361 |
|
|
| 362 |
|
$this->addItem($item1); |
| 363 |
|
$this->addItem($item2); |
| 364 |
|
$this->addAdjustment($adjustment1); |
| 365 |
|
$this->addAdjustment($adjustment2); |
| 366 |
|
|
| 367 |
|
$this->getTotal()->shouldReturn(80000); |
| 368 |
|
} |
| 369 |
|
|
| 370 |
|
function it_calculates_correct_total_after_items_and_adjustments_changes( |
| 371 |
|
AdjustmentInterface $adjustment1, |
|
@@ 419-444 (lines=26) @@
|
| 416 |
|
$this->getTotal()->shouldReturn(80000); |
| 417 |
|
} |
| 418 |
|
|
| 419 |
|
function it_ignores_neutral_adjustments_when_calculating_total(OrderItemInterface $item1, OrderItemInterface $item2, AdjustmentInterface $adjustment1, AdjustmentInterface $adjustment2) |
| 420 |
|
{ |
| 421 |
|
$item1->getTotal()->willReturn(29999); |
| 422 |
|
$item2->getTotal()->willReturn(45000); |
| 423 |
|
|
| 424 |
|
$item1->equals(Argument::any())->willReturn(false); |
| 425 |
|
$item2->equals(Argument::any())->willReturn(false); |
| 426 |
|
|
| 427 |
|
$item1->setOrder($this)->shouldBeCalled(); |
| 428 |
|
$item2->setOrder($this)->shouldBeCalled(); |
| 429 |
|
|
| 430 |
|
$adjustment1->isNeutral()->willReturn(true); |
| 431 |
|
$adjustment1->getAmount()->willReturn(10000); |
| 432 |
|
$adjustment2->isNeutral()->willReturn(false); |
| 433 |
|
$adjustment2->getAmount()->willReturn(-4999); |
| 434 |
|
|
| 435 |
|
$adjustment1->setAdjustable($this)->shouldBeCalled(); |
| 436 |
|
$adjustment2->setAdjustable($this)->shouldBeCalled(); |
| 437 |
|
|
| 438 |
|
$this->addItem($item1); |
| 439 |
|
$this->addItem($item2); |
| 440 |
|
$this->addAdjustment($adjustment1); |
| 441 |
|
$this->addAdjustment($adjustment2); |
| 442 |
|
|
| 443 |
|
$this->getTotal()->shouldReturn(70000); |
| 444 |
|
} |
| 445 |
|
|
| 446 |
|
function it_calculates_correct_total_when_adjustment_is_bigger_than_cost(OrderItemInterface $item, AdjustmentInterface $adjustment) |
| 447 |
|
{ |