24 private $orderRepository;
29 private $caseManagement;
34 private $cancelGuaranteeAbility;
41 $this->orderRepository = $this->getMockBuilder(OrderRepositoryInterface::class)
42 ->getMockForAbstractClass();
44 $this->caseManagement = $this->getMockBuilder(CaseManagement::class)
45 ->disableOriginalConstructor()
49 $this->caseManagement,
50 $this->orderRepository
57 public function testIsAvailableSuccess()
62 $case = $this->getMockBuilder(CaseInterface::class)
63 ->disableOriginalConstructor()
66 $case->expects($this->once())
67 ->method(
'getGuaranteeDisposition')
70 $this->caseManagement->expects($this->once())
71 ->method(
'getByOrderId')
76 $order = $this->getMockBuilder(OrderInterface::class)
77 ->getMockForAbstractClass();
79 $this->orderRepository->expects($this->once())
84 $this->assertTrue($this->cancelGuaranteeAbility->isAvailable($orderId));
94 $this->caseManagement->expects($this->once())
95 ->method(
'getByOrderId')
99 $this->assertFalse($this->cancelGuaranteeAbility->isAvailable($orderId));
105 public function testIsAvailableWithCanceledGuarantee()
110 $case = $this->getMockBuilder(CaseInterface::class)
111 ->disableOriginalConstructor()
114 $case->expects($this->once())
115 ->method(
'getGuaranteeDisposition')
118 $this->caseManagement->expects($this->once())
119 ->method(
'getByOrderId')
123 $this->assertFalse($this->cancelGuaranteeAbility->isAvailable($orderId));
129 public function testIsAvailableWithNullOrder()
134 $case = $this->getMockBuilder(CaseInterface::class)
135 ->disableOriginalConstructor()
138 $case->expects($this->once())
139 ->method(
'getGuaranteeDisposition')
142 $this->caseManagement->expects($this->once())
143 ->method(
'getByOrderId')
147 $this->orderRepository->expects($this->once())
152 $this->assertFalse($this->cancelGuaranteeAbility->isAvailable($orderId));
testIsAvailableWithNullCase()