public function testGetOptions() { $res = []; foreach ($this->getOptionArray() as $index => $value) { $res[] = ['value' => $index, 'label' => $value]; } $this->assertEquals($res, $this->_model->getOptions()); }
/** * Automaticaly assign backend model to weee attributes * * @param \Magento\Framework\Event\Observer $observer * @return $this */ public function execute(\Magento\Framework\Event\Observer $observer) { $backendModel = \Magento\Weee\Model\Attribute\Backend\Weee\Tax::getBackendModelName(); /** @var $object \Magento\Eav\Model\Entity\Attribute\AbstractAttribute */ $object = $observer->getEvent()->getAttribute(); if ($object->getFrontendInput() == 'weee') { $object->setBackendModel($backendModel); if (!$object->getApplyTo()) { $applyTo = []; foreach ($this->productType->getOptions() as $option) { if ($this->productTypeConfig->isProductSet($option['value'])) { continue; } $applyTo[] = $option['value']; } $object->setApplyTo($applyTo); } } return $this; }
public function testGetOptions() { $options = $this->_productType->getOptions(); $this->_assertOptions($options); }
/** * {@inheritdoc} */ public function getOptions() { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getOptions'); if (!$pluginInfo) { return parent::getOptions(); } else { return $this->___callPlugins('getOptions', func_get_args(), $pluginInfo); } }