protected function setUp() { $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->urlBuilderMock = $this->getMock('Magento\\Framework\\Url', [], [], '', false); $this->image = $objectManager->getObject('Magento\\Config\\Block\\System\\Config\\Form\\Field\\Image', ['urlBuilder' => $this->urlBuilderMock]); $this->testData = ['html_id_prefix' => 'test_id_prefix_', 'html_id' => 'test_id', 'html_id_suffix' => '_test_id_suffix', 'path' => 'catalog/product/placeholder', 'value' => 'test_value']; $formMock = new \Magento\Framework\DataObject(); $formMock->setHtmlIdPrefix($this->testData['html_id_prefix']); $formMock->setHtmlIdSuffix($this->testData['html_id_suffix']); $this->image->setForm($formMock); }
protected function setUp() { $factoryMock = $this->getMock('Magento\\Framework\\Data\\Form\\Element\\Factory', [], [], '', false); $collectionFactoryMock = $this->getMock('Magento\\Framework\\Data\\Form\\Element\\CollectionFactory', [], [], '', false); $escaperMock = $this->getMock('Magento\\Framework\\Escaper', [], [], '', false); $this->urlBuilderMock = $this->getMock('Magento\\Framework\\Url', [], [], '', false); $this->_image = new \Magento\Config\Block\System\Config\Form\Field\Image($factoryMock, $collectionFactoryMock, $escaperMock, $this->urlBuilderMock); $formMock = new \Magento\Framework\Object(); $formMock->getHtmlIdPrefix('id_prefix'); $formMock->getHtmlIdPrefix('id_suffix'); $this->_image->setForm($formMock); }