/** * Return options. * * @return mixed */ public function toOptionArray() { $options = $this->productType->getAllOptions(); //Add default option to first key of array. First key has empty value and empty label. $options[0]['value'] = '0'; $options[0]['label'] = '---- Default Option ----'; return $options; }
public function testGetAllOptions() { $res[] = ['value' => '', 'label' => '']; foreach ($this->getOptionArray() as $index => $value) { $res[] = ['value' => $index, 'label' => $value]; } $this->assertEquals($res, $this->_model->getAllOptions()); }
/** * {@inheritdoc} */ public function getAllOptions() { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getAllOptions'); if (!$pluginInfo) { return parent::getAllOptions(); } else { return $this->___callPlugins('getAllOptions', func_get_args(), $pluginInfo); } }
public function testGetAllOptions() { $options = $this->_productType->getAllOptions(); $types = $this->_assertOptions($options); $this->assertContains('', $types); }