/** * Returns array to be used in multiselect on back-end * * @return array */ public function toOptionArray() { $configData = $this->_shippingDhl->getCode($this->_code); $arr = array(); foreach ($configData as $code => $title) { $arr[] = array('value' => $code, 'label' => $title); } return $arr; }
public function testCollectRates() { $this->_httpResponse->expects($this->any())->method('getBody')->will($this->returnValue(file_get_contents(__DIR__ . '/_files/success_dhl_response_rates.xml'))); // for setRequest $request = $this->_helper->getObject('Magento\\Quote\\Model\\Quote\\Address\\RateRequest', require __DIR__ . '/_files/rates_request_data_dhl.php'); $this->assertNotEmpty($this->_model->collectRates($request)->getAllRates()); }
public function testCollectRatesFail() { $this->scope->expects($this->once())->method('isSetFlag')->willReturn(true); $request = new RateRequest(); $request->setPackageWeight(1); $this->assertFalse(false, $this->_model->collectRates($request)); }
/** * Define params and variables * * @return void */ public function _construct() { parent::_construct(); $this->setInch($this->carrierDhl->getCode('unit_of_dimension_cut', 'I')); $this->setCm($this->carrierDhl->getCode('unit_of_dimension_cut', 'C')); $this->setHeight($this->carrierDhl->getCode('dimensions', 'height')); $this->setDepth($this->carrierDhl->getCode('dimensions', 'depth')); $this->setWidth($this->carrierDhl->getCode('dimensions', 'width')); $kgWeight = 70; $this->setDivideOrderWeightNoteKg(__('Select this to allow DHL to optimize shipping charges by splitting the order if it exceeds %1 %2.', $kgWeight, 'kg')); $weight = round($this->carrierHelper->convertMeasureWeight($kgWeight, \Zend_Measure_Weight::KILOGRAM, \Zend_Measure_Weight::POUND), 3); $this->setDivideOrderWeightNoteLbp(__('Select this to allow DHL to optimize shipping charges by splitting the order if it exceeds %1 %2.', $weight, 'pounds')); $this->setTemplate('unitofmeasure.phtml'); }