public function testValidateMiniumumAmountNegative() { $storeId = 1; $this->quote->setStoreId($storeId); $valueMap = [['sales/minimum_order/active', ScopeInterface::SCOPE_STORE, $storeId, true], ['sales/minimum_order/multi_address', ScopeInterface::SCOPE_STORE, $storeId, true], ['sales/minimum_order/amount', ScopeInterface::SCOPE_STORE, $storeId, 20], ['sales/minimum_order/tax_including', ScopeInterface::SCOPE_STORE, $storeId, true]]; $this->scopeConfig->expects($this->any())->method('isSetFlag')->will($this->returnValueMap($valueMap)); $this->quoteAddressMock->expects($this->once())->method('validateMinimumAmount')->willReturn(false); $this->quoteAddressCollectionMock->expects($this->once())->method('setQuoteFilter')->willReturn([$this->quoteAddressMock]); $this->assertFalse($this->quote->validateMinimumAmount()); }
public function testRemoveAllAddresses() { $id = 1; $this->quoteAddressCollectionMock->expects($this->once())->method('setQuoteFilter')->with($id)->will($this->returnSelf()); $this->quoteAddressMock->expects($this->any())->method('getAddressType')->will($this->returnValue(\Magento\Customer\Model\Address\AbstractAddress::TYPE_SHIPPING)); $this->quoteAddressMock->expects($this->any())->method('isDeleted')->will($this->returnValue(false)); $this->quoteAddressMock->expects($this->once())->method('getId')->will($this->returnValue($id)); $this->quoteAddressMock->expects($this->once())->method('getDeleteImmediately')->will($this->returnValue(true)); $iterator = new \ArrayIterator([$id => $this->quoteAddressMock]); $this->quoteAddressCollectionMock->expects($this->any())->method('getIterator')->will($this->returnValue($iterator)); $this->quoteAddressCollectionMock->expects($this->once())->method('removeItemByKey')->with($id)->will($this->returnValue($iterator)); $this->quote->setId($id); $result = $this->quote->removeAllAddresses(); $this->assertInstanceOf('Magento\\Sales\\Model\\Quote', $result); }