45 $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
47 $this->authorizationMock = $this->createMock(\
Magento\Framework\Authorization::class);
48 $this->coreRegistryMock = $this->createMock(\
Magento\Framework\Registry::class);
49 $this->orderMock = $this->createMock(\
Magento\Sales\Model\Order::class);
50 $this->paymentMock = $this->createMock(\
Magento\Sales\Model\Order\Payment::class);
52 $this->coreRegistryMock->expects($this->any())
54 ->with(
'current_order')
55 ->willReturn($this->orderMock);
57 $this->orderMock->expects($this->any())
58 ->method(
'getPayment')
59 ->willReturn($this->paymentMock);
61 $this->transactionsTab = $this->objectManager->getObject(
62 \
Magento\Sales\Block\Adminhtml\Order\View\Tab\Transactions::class,
64 'authorization' => $this->authorizationMock,
65 'registry' => $this->coreRegistryMock
72 $this->assertInstanceOf(\
Magento\Sales\Model\Order::class, $this->transactionsTab->getOrder());
83 $methodInstance = $this->objectManager->getObject($methodClass);
84 $this->paymentMock->expects($this->any())
85 ->method(
'getMethodInstance')
86 ->willReturn($methodInstance);
88 $this->assertEquals($expectedResult, $this->transactionsTab->canShowTab());
97 [\Magento\Sales\Test\Unit\Block\Adminhtml\Order\View\Tab\Stub\OnlineMethod::class,
true],
98 [\Magento\OfflinePayments\Model\Cashondelivery::class,
false],
99 [\Magento\OfflinePayments\Model\Checkmo::class,
false],
100 [\Magento\OfflinePayments\Model\Banktransfer::class,
false],
101 [\Magento\OfflinePayments\Model\Purchaseorder::class,
false]
112 $this->authorizationMock->expects($this->any())
113 ->method(
'isAllowed')
114 ->with(
'Magento_Sales::transactions_fetch')
117 $this->assertEquals($expectedResult, $this->transactionsTab->isHidden());
testCanShowTab($methodClass, $expectedResult)
testIsHidden($isAllowed, $expectedResult)