public function testUndoAllocation()
 {
     $this->inventorySession = $this->getModelMockBuilder('ebayenterprise_inventory/session')->disableOriginalConstructor()->setMethods(null)->getMock();
     $svc = $this->getModelMockBuilder('ebayenterprise_inventory/allocation_service')->setMethods(['getInventorySession', 'createDeallocator'])->setConstructorArgs([['logger' => $this->logger, 'log_context' => $this->logContext]])->getMock();
     $reservation = Mage::getModel('ebayenterprise_inventory/allocation_reservation');
     $result = Mage::getModel('ebayenterprise_inventory/allocation_result', ['reservation' => $reservation]);
     $coreHelper = $this->getHelperMockBuilder('eb2ccore/data')->disableOriginalConstructor()->setMethods(['getSdkApi'])->getMock();
     $coreHelper->expects($this->once())->method('getSdkApi')->with($this->identicalTo('inventory'), $this->identicalTo('allocations/delete'))->will($this->returnValue($this->httpApi));
     $this->request->expects($this->once())->method('setReservationId')->with($reservation->getId())->will($this->returnSelf());
     $deallocator = Mage::getModel('ebayenterprise_inventory/allocation_deallocator', ['logger' => $this->logger, 'log_context' => $this->logContext, 'core_helper' => $coreHelper]);
     $this->inventorySession->setAllocationResult($result);
     $this->assertSame($result, $this->inventorySession->getAllocationResult());
     $svc->expects($this->atLeastOnce())->method('getInventorySession')->will($this->returnValue($this->inventorySession));
     $svc->expects($this->atLeastOnce())->method('createDeallocator')->will($this->returnValue($deallocator));
     $svc->undoAllocation();
 }
 /**
  * When clearing collected results, any stored quantity results should
  * be removed from storage, preventing them from being reused.
  */
 public function testClearResults()
 {
     // Side-effect test: results currently stored in session, setting the
     // sessions quantity results to null will remove any existing results
     // from being reused.
     $this->_inventorySession->expects($this->once())->method('setQuantityResults')->with($this->identicalTo(null))->will($this->returnSelf());
     $this->assertSame($this->_quantityCollector, $this->_quantityCollector->clearResults());
 }