/** * Get value select options * * @return array|mixed */ public function getValueSelectOptions() { if (!$this->hasData('value_select_options')) { switch ($this->getAttribute()) { case 'country_id': $options = $this->_directoryCountry->toOptionArray(); break; case 'region_id': $options = $this->_directoryAllregion->toOptionArray(); break; case 'shipping_method': $options = $this->_shippingAllmethods->toOptionArray(); break; case 'payment_method': $options = $this->_paymentAllmethods->toOptionArray(); break; default: $options = []; } $this->setData('value_select_options', $options); } return $this->getData('value_select_options'); }
/** * Options array. * * @return array */ public function toOptionArray() { return $this->allPaymentMethods->toOptionArray(); }
public function testToOptionArray() { $expectedArray = ['key' => 'value']; $this->_paymentData->expects($this->once())->method('getPaymentMethodList')->with(true, true, true)->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $this->_model->toOptionArray()); }