public function setUp()
 {
     // Mock session storage for previously collected quantity results
     $this->_inventorySession = $this->getModelMockBuilder('ebayenterprise_inventory/session')->setMethods(['getQuantityResults', 'setQuantityResults', 'getResultsCollectedFor', 'setResultsCollectedFor'])->disableOriginalConstructor()->getMock();
     // Mock of the sdk helper for getting new quantity results from the API
     $this->_quantitySdkHelper = $this->getHelperMock('ebayenterprise_inventory/quantity_sdk', ['requestQuantityForItems']);
     // A quantity results stub, expected to be returned by the session or
     // sdk helper.
     $this->_quantityResults = $this->getModelMockBuilder('ebayenterprise_inventory/quantity_results')->disableOriginalConstructor()->setMethods(['checkResultsApplyToItems'])->getMock();
     // Stub quote object to collect quantity records for.
     $this->_quote = $this->getModelMock('sales/quote', ['getAllItems']);
     // Stub quote item that should be sent to the inventory service.
     $this->_quoteItem = $this->getModelMock('sales/quote_item', []);
     // Quote items and filtered quote items allow tests to distinguish
     // between all items in the quote and just items that matter to the
     // inventory service. All quote items includes an additional quote item
     // that is not expected to be sent to the quantity API.
     $this->_quoteItems = [$this->_quoteItem, $this->getModelMock('sales/quote_item', [])];
     $this->_filteredQuoteItems = [$this->_quoteItem];
     // Stub quote to return all quote items.
     $this->_quote->expects($this->any())->method('getAllItems')->will($this->returnValue($this->_quoteItems));
     // Stub filtering from the full quote items down to the filtered
     // array of quote items. Tests that expect a list of items that matter
     // to the inventory service can expect the filted quote items array
     // instead of the unfiltered quote items array.
     $this->_itemSelection = $this->getHelperMock('ebayenterprise_inventory/item_selection', ['selectFrom']);
     $this->_itemSelection->expects($this->any())->method('selectFrom')->with($this->identicalTo($this->_quoteItems))->will($this->returnValue($this->_filteredQuoteItems));
     // Mock helper for calculating item quantities.
     $this->_quantityHelper = $this->getHelperMock('ebayenterprise_inventory/quantity', ['calculateTotalQuantitiesBySku']);
     $this->_currentItemQuantityData = ['a-sku' => 100];
     $this->_quantityHelper->expects($this->any())->method('calculateTotalQuantitiesBySku')->with($this->_filteredQuoteItems)->will($this->returnValue($this->_currentItemQuantityData));
     $this->_quantityCollector = Mage::getModel('ebayenterprise_inventory/quantity_collector', ['quantity_sdk_helper' => $this->_quantitySdkHelper, 'quantity_helper' => $this->_quantityHelper, 'item_selection' => $this->_itemSelection, 'inventory_session' => $this->_inventorySession]);
 }