forked from Sylius/Sylius
/
OrderAdjustmentsClearerSpec.php
51 lines (41 loc) · 1.92 KB
/
OrderAdjustmentsClearerSpec.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace spec\Sylius\Component\Core\OrderProcessing;
use PhpSpec\ObjectBehavior;
use Sylius\Component\Core\Model\AdjustmentInterface;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Order\Processor\OrderProcessorInterface;
final class OrderAdjustmentsClearerSpec extends ObjectBehavior
{
function it_is_an_order_processor(): void
{
$this->shouldImplement(OrderProcessorInterface::class);
}
function it_removes_adjustments_with_default_types_from_order_recursively(OrderInterface $order): void
{
$order->removeAdjustmentsRecursively(AdjustmentInterface::ORDER_ITEM_PROMOTION_ADJUSTMENT)->shouldBeCalled();
$order->removeAdjustmentsRecursively(AdjustmentInterface::ORDER_PROMOTION_ADJUSTMENT)->shouldBeCalled();
$order->removeAdjustmentsRecursively(AdjustmentInterface::ORDER_SHIPPING_PROMOTION_ADJUSTMENT)->shouldBeCalled();
$order->removeAdjustmentsRecursively(AdjustmentInterface::ORDER_UNIT_PROMOTION_ADJUSTMENT)->shouldBeCalled();
$order->removeAdjustmentsRecursively(AdjustmentInterface::TAX_ADJUSTMENT)->shouldBeCalled();
$this->process($order);
}
function it_removes_adjustments_with_specified_types_from_order_recursively(OrderInterface $order): void
{
$this->beConstructedWith([
AdjustmentInterface::ORDER_ITEM_PROMOTION_ADJUSTMENT,
AdjustmentInterface::ORDER_PROMOTION_ADJUSTMENT,
]);
$order->removeAdjustmentsRecursively(AdjustmentInterface::ORDER_ITEM_PROMOTION_ADJUSTMENT)->shouldBeCalled();
$order->removeAdjustmentsRecursively(AdjustmentInterface::ORDER_PROMOTION_ADJUSTMENT)->shouldBeCalled();
$this->process($order);
}
}