コード例 #1
1
ファイル: Generic.php プロジェクト: pradeep-wagento/magento2
 /**
  * Returns array to be used in multiselect on back-end
  *
  * @return array
  */
 public function toOptionArray()
 {
     $options = [];
     $codes = $this->shippingUsps->getCode($this->code);
     if ($codes) {
         foreach ($codes as $code => $title) {
             $options[] = ['value' => $code, 'label' => __($title)];
         }
     }
     return $options;
 }
コード例 #2
0
ファイル: CarrierTest.php プロジェクト: Doability/magento2dev
 public function testCollectRatesFail()
 {
     $this->scope->expects($this->once())->method('isSetFlag')->willReturn(true);
     $this->scope->expects($this->atLeastOnce())->method('getValue')->willReturnMap([['carriers/usps/userid' => 123], ['carriers/usps/container' => 11]]);
     $request = new RateRequest();
     $request->setPackageWeight(1);
     $this->assertNotEmpty($this->carrier->collectRates($request));
 }
コード例 #3
0
 public function testReturnOfShipment()
 {
     $this->_httpResponse->expects($this->any())->method('getBody')->will($this->returnValue(file_get_contents(__DIR__ . '/_files/success_usps_response_return_shipment.xml')));
     $request = $this->_helper->getObject('Magento\\Shipping\\Model\\Shipment\\ReturnShipment', require __DIR__ . '/_files/return_shipment_request_data.php');
     $this->assertNotEmpty($this->_model->returnOfShipment($request)->getInfo()[0]['tracking_number']);
 }
コード例 #4
0
 /**
  * @dataProvider getCodeDataProvider
  * @param array$expected array
  * @param array $options
  */
 public function testToOptionArray($expected, $options)
 {
     $this->_uspsModel->expects($this->any())->method('getCode')->will($this->returnValue($options));
     $this->assertEquals($expected, $this->_generic->toOptionArray());
 }