/**
  * When the session has results but they no longer apply to the quote,
  * a new set of results should be requested and replace the existing
  * results in the session.
  */
 public function testGetQuantityResultsForQuoteSessionDataOutdated()
 {
     $outdatedResults = $this->getModelMockBuilder('ebayenterprise_inventory/quantity_results')->disableOriginalConstructor()->setMethods(['checkResultsApplyToItems'])->getMock();
     $outdatedResults->expects($this->any())->method('checkResultsApplyToItems')->with($this->_currentItemQuantityData)->will($this->returnValue(false));
     // Expect the session to return quantity results.
     $this->_inventorySession->expects($this->any())->method('getQuantityResults')->will($this->returnValue($outdatedResults));
     // Side-effect test: ensure that new results are requested from the
     // API via the SDK helper.
     $this->_quantitySdkHelper->expects($this->once())->method('requestQuantityForItems')->with($this->identicalTo($this->_filteredQuoteItems))->will($this->returnValue($this->_quantityResults));
     // Side-effect test: ensure that the newly collected results are put
     // into the session for later use.
     $this->_inventorySession->expects($this->once())->method('setQuantityResults')->with($this->identicalTo($this->_quantityResults))->will($this->returnSelf());
     $this->assertSame($this->_quantityResults, $this->_quantityCollector->getQuantityResultsForQuote($this->_quote));
 }
 /**
  * Request new quantity results.
  *
  * @param Mage_Sales_Model_Quote_Item[]
  * @return EbayEnterprise_Inventory_Model_Quantity_Restults
  */
 protected function _requestNewResults($items)
 {
     $results = $this->_quantitySdkHelper->requestQuantityForItems($items);
     $this->_getInventorySession()->setQuantityResults($results);
     return $results;
 }