13 use PHPUnit_Framework_MockObject_MockObject as MockObject;
27 self::assertEquals($expectedReturn, $actualReturn);
37 $this->getOrder(
'pending', [
'pending' =>
'pending']),
41 $this->getOrder(
'processing', [
'pending' =>
'pending']),
52 private function getOrder($newOrderStatus, $stateStatuses)
54 $order = $this->getMockBuilder(OrderInterface::class)
55 ->setMethods([
'getConfig'])
56 ->getMockForAbstractClass();
57 $order->method(
'getPayment')
58 ->willReturn($this->getPayment($newOrderStatus));
59 $order->method(
'getConfig')
60 ->willReturn($this->getConfig($stateStatuses));
69 private function getPayment($newOrderStatus)
71 $payment = $this->getMockBuilder(OrderPaymentInterface::class)
72 ->setMethods([
'getMethodInstance'])
73 ->getMockForAbstractClass();
74 $payment->method(
'getMethodInstance')
75 ->willReturn($this->getMethodInstance($newOrderStatus));
84 private function getMethodInstance($newOrderStatus)
86 $methodInstance = $this->getMockBuilder(MethodInterface::class)
87 ->getMockForAbstractClass();
88 $methodInstance->method(
'getConfigData')
89 ->with(
'order_status')
90 ->willReturn($newOrderStatus);
92 return $methodInstance;
99 private function getConfig($stateStatuses)
101 $config = $this->getMockBuilder(Config::class)
102 ->disableOriginalConstructor()
104 $config->method(
'getStateStatuses')
105 ->willReturn($stateStatuses);
106 $config->method(
'getStateDefaultStatus')
107 ->willReturn(
'processing');
testGetOrderStatusByState($order, $expectedReturn)