/**
  * Inject data from the quote into the quantity request
  * payload.
  *
  * @return self
  */
 protected function _populatePayload()
 {
     $itemIterable = $this->_quantityPayload->getQuantityItems();
     foreach ($this->_items as $item) {
         $itemPayload = $this->_payloadHelper->itemToRequestQuantityItem($item, $itemIterable->getEmptyQuantityItem());
         $itemIterable[$itemPayload] = $itemPayload;
     }
     $this->_quantityPayload->setQuantityItems($itemIterable);
     $this->_isPayloadPopulated = true;
     return $this;
 }
 /**
  * When transferring data from an item to a quantity
  * request item, the item sku, id and fulfillment location
  * data should be transferred to the payload.
  */
 public function testItemToRequestQuantityItem()
 {
     $sku = '45-12345';
     $id = 9;
     $locationId = 'location-id';
     $locationType = 'ISPU';
     $item = $this->_mockQuoteItem($sku, $id, $locationId, $locationType);
     $itemPayload = $this->getMockForAbstractClass('eBayEnterprise\\RetailOrderManagement\\Payload\\Inventory\\IRequestQuantityItem', ['setItemId', 'setLineId', 'setFulfillmentLocationId', 'setFulfillmentLocationType']);
     $itemPayload->expects($this->once())->method('setItemId')->with($this->identicalTo($sku))->will($this->returnSelf());
     $itemPayload->expects($this->once())->method('setLineId')->with($this->identicalTo($id))->will($this->returnSelf());
     $itemPayload->expects($this->once())->method('setFulfillmentLocationId')->with($this->identicalTo($locationId))->will($this->returnSelf());
     $itemPayload->expects($this->once())->method('setFulfillmentLocationType')->with($this->identicalTo($locationType))->will($this->returnSelf());
     $this->assertSame($itemPayload, $this->_payloadHelper->itemToRequestQuantityItem($item, $itemPayload));
 }