/** * Check buttons * * @param \Magento\UrlRewrite\Block\Edit $block * @param array $expected */ private function _checkButtons($block, $expected) { $buttonsHtml = $block->getButtonsHtml(); if ($expected['back_button']) { $this->assertSelectCount('button.back', 1, $buttonsHtml, 'Back button is not present in block'); } else { $this->assertSelectCount('button.back', 0, $buttonsHtml, 'Back button should not present in block'); } if ($expected['save_button']) { $this->assertSelectCount('button.save', 1, $buttonsHtml, 'Save button is not present in block'); } else { $this->assertSelectCount('button.save', 0, $buttonsHtml, 'Save button should not present in block'); } if ($expected['reset_button']) { $this->assertSelectCount('button[title="Reset"]', 1, $buttonsHtml, 'Reset button is not present in block'); } else { $this->assertSelectCount('button[title="Reset"]', 0, $buttonsHtml, 'Reset button should not present in block'); } if ($expected['delete_button']) { $this->assertSelectCount('button.delete', 1, $buttonsHtml, 'Delete button is not present in block'); } else { $this->assertSelectCount('button.delete', 0, $buttonsHtml, 'Delete button should not present in block'); } }
/** * @param \Magento\Backend\Block\Widget\Context $context * @param \Magento\UrlRewrite\Model\UrlRewriteFactory $rewriteFactory * @param \Magento\Backend\Helper\Data $adminhtmlData * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory * @param array $data */ public function __construct(\Magento\Backend\Block\Widget\Context $context, \Magento\UrlRewrite\Model\UrlRewriteFactory $rewriteFactory, \Magento\Backend\Helper\Data $adminhtmlData, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Catalog\Model\CategoryFactory $categoryFactory, array $data = []) { $this->_categoryFactory = $categoryFactory; $this->_productFactory = $productFactory; parent::__construct($context, $rewriteFactory, $adminhtmlData, $data); }