45 $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
47 $this->contextMock = $this->createPartialMock(\
Magento\Backend\Block\Template\Context::class, [
'getRequest']);
48 $this->backordersMock = $this->createMock(\
Magento\CatalogInventory\Model\Source\Backorders::class);
49 $this->stockConfigurationMock = $this->getMockForAbstractClass(
50 \
Magento\CatalogInventory\Api\StockConfigurationInterface::class,
55 $this->requestMock = $this->getMockForAbstractClass(
56 \
Magento\Framework\
App\RequestInterface::class,
62 $this->contextMock->expects($this->once())
63 ->method(
'getRequest')
64 ->will($this->returnValue($this->requestMock));
67 \
Magento\Catalog\Block\Adminhtml\Product\Edit\Action\Attribute\Tab\Inventory::class,
69 'context' => $this->contextMock,
70 'backorders' => $this->backordersMock,
71 'stockConfiguration' => $this->stockConfigurationMock
83 $this->backordersMock->expects($this->once())
84 ->method(
'toOptionArray')
85 ->will($this->returnValue(
'return-value'));
86 $this->assertEquals(
'return-value', $this->inventory->getBackordersOption());
96 $this->assertEquals(
'inventory', $this->inventory->getFieldSuffix());
106 $this->requestMock->expects($this->once())
109 ->will($this->returnValue(
'125'));
111 $this->assertTrue(is_integer($this->inventory->getStoreId()));
121 $this->stockConfigurationMock->expects($this->once())
122 ->method(
'getDefaultConfigValue')
124 ->will($this->returnValue(
'return-value'));
126 $this->assertEquals(
'return-value', $this->inventory->getDefaultConfigValue(
'field-name'));
136 $this->assertEquals(
'Advanced Inventory', $this->inventory->getTabLabel());
146 $this->assertEquals(
'Advanced Inventory', $this->inventory->getTabLabel());
156 $this->assertTrue($this->inventory->canShowTab());
166 $this->assertFalse($this->inventory->isHidden());
176 $this->assertEquals(
true, $this->inventory->isAvailable(
'field'));
testGetDefaultConfigValue()
testGetBackordersOption()