public function testGetTypes() { $label = 'someLabel'; $value = 'someValue'; $this->typeModel->expects($this->once())->method('toOptionArray')->will($this->returnValue([['label' => $label, 'value' => $value]])); $this->typeConverter->expects($this->once())->method('createDataFromModel')->will($this->returnValue($this->type)); $this->assertEquals([$this->type], $this->model->getTypes()); }
/** * {@inheritdoc} */ public function getTypes() { $optionList = $this->type->toOptionArray(); /** @var Type[] $typeDtoList */ $typeDtoList = []; foreach ($optionList as $option) { $typeDtoList[] = $this->typeConverter->createDataFromModel($option); } return $typeDtoList; }
/** * @return mixed */ public function getTypeSelectHtml() { $select = $this->getLayout()->createBlock('Magento\\Framework\\View\\Element\\Html\\Select')->setData(array('id' => $this->getFieldId() . '_{{index}}_type', 'class' => 'select select-product-option-type required-option-select', 'extra_params' => 'onchange="bOption.changeType(event)"'))->setName($this->getFieldName() . '[{{index}}][type]')->setOptions($this->_optionTypes->toOptionArray()); return $select->getHtml(); }