예제 #1
0
 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);
 }