@SuppressWarnings(PHPMD.LongVariable)
Definition at line 11 of file StockTest.php.
◆ setUp()
Definition at line 40 of file StockTest.php.
42 $this->_factoryElementMock = $this->createMock(\
Magento\Framework\Data\Form\Element\Factory::class);
43 $this->_collectionFactoryMock = $this->createMock(
44 \
Magento\Framework\Data\Form\Element\CollectionFactory::class
46 $this->_qtyMock = $this->createPartialMock(
47 \
Magento\Framework\Data\Form\Element\Text::class,
48 [
'setForm',
'setValue',
'setName']
50 $this->_factoryTextMock = $this->createMock(\
Magento\Framework\Data\Form\Element\TextFactory::class);
52 $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
53 $this->_block = $objectManagerHelper->getObject(
54 \
Magento\CatalogInventory\Block\Adminhtml\Form\Field\Stock::class,
56 'factoryElement' => $this->_factoryElementMock,
57 'factoryCollection' => $this->_collectionFactoryMock,
58 'factoryText' => $this->_factoryTextMock,
59 'data' => [
'qty' => $this->_qtyMock,
'name' => self::ATTRIBUTE_NAME]
◆ testSetForm()
Definition at line 64 of file StockTest.php.
66 $this->_qtyMock->expects(
71 $this->isInstanceOf(\
Magento\Framework\Data\Form\Element\AbstractElement::class)
74 $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
75 $this->_block->setForm(
77 \
Magento\Framework\Data\Form\Element\Text::class,
79 'factoryElement' => $this->_factoryElementMock,
80 'factoryCollection' => $this->_collectionFactoryMock
◆ testSetName()
Definition at line 94 of file StockTest.php.
96 $this->_qtyMock->expects($this->once())->method(
'setName')->with(self::ATTRIBUTE_NAME .
'[qty]');
98 $this->_block->setName(self::ATTRIBUTE_NAME);
◆ testSetValue()
Definition at line 86 of file StockTest.php.
88 $value = [
'qty' => 1,
'is_in_stock' => 0];
89 $this->_qtyMock->expects($this->once())->method(
'setValue')->with($this->equalTo(1));
91 $this->_block->setValue(
$value);
◆ $_block
◆ $_collectionFactoryMock
◆ $_factoryElementMock
◆ $_factoryTextMock
◆ $_qtyMock
◆ ATTRIBUTE_NAME
const ATTRIBUTE_NAME = 'quantity_and_stock_status' |
The documentation for this class was generated from the following file:
- vendor/magento/module-catalog-inventory/Test/Unit/Block/Adminhtml/Form/Field/StockTest.php