Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ShipmentLabelGetTest.php
Go to the documentation of this file.
1 <?php
7 
9 
14 {
15  const RESOURCE_PATH = '/V1/shipment';
16  const SERVICE_READ_NAME = 'salesShipmentManagementV1';
17  const SERVICE_VERSION = 'V1';
18 
22  protected $objectManager;
23 
24  protected function setUp()
25  {
27  }
28 
32  public function testShipmentGet()
33  {
35  $shipmentCollection = $this->objectManager->get(
36  \Magento\Sales\Model\ResourceModel\Order\Shipment\Collection::class
37  );
38  $shipment = $shipmentCollection->getFirstItem();
39  $shipment->setShippingLabel('test_shipping_label');
40  $shipment->save();
41  $serviceInfo = [
42  'rest' => [
43  'resourcePath' => self::RESOURCE_PATH . '/' . $shipment->getId() . '/label',
45  ],
46  'soap' => [
47  'service' => self::SERVICE_READ_NAME,
48  'serviceVersion' => self::SERVICE_VERSION,
49  'operation' => self::SERVICE_READ_NAME . 'getLabel',
50  ],
51  ];
52  $result = $this->_webApiCall($serviceInfo, ['id' => $shipment->getId()]);
53  $this->assertEquals($result, base64_encode('test_shipping_label'));
54  }
55 }
_webApiCall( $serviceInfo, $arguments=[], $webApiAdapterCode=null, $storeCode=null, $integration=null)
foreach($order->getItems() as $orderItem) $shipment