Example #1
0
 protected function setUp()
 {
     $this->quoteAddressFactoryMock = $this->getMock('Magento\\Sales\\Model\\Quote\\AddressFactory', array('create'), array(), '', false);
     $this->quoteAddressMock = $this->getMock('Magento\\Sales\\Model\\Quote\\Address', ['isDeleted', 'getCollection', 'getId', 'getCustomerAddressId', '__wakeup', 'getAddressType', 'getDeleteImmediately'], [], '', false);
     $this->quoteAddressCollectionMock = $this->getMock('Magento\\Sales\\Model\\Resource\\Quote\\Address\\Collection', array(), array(), '', false);
     $this->productMock = $this->getMock('\\Magento\\Catalog\\Model\\Product', [], [], '', false);
     $this->objectFactoryMock = $this->getMock('\\Magento\\Framework\\Object\\Factory', ['create'], [], '', false);
     $this->quoteAddressFactoryMock->expects($this->any())->method('create')->will($this->returnValue($this->quoteAddressMock));
     $this->quoteAddressMock->expects($this->any())->method('getCollection')->will($this->returnValue($this->quoteAddressCollectionMock));
     $this->eventManagerMock = $this->getMockBuilder('Magento\\Framework\\Event\\Manager')->disableOriginalConstructor()->getMock();
     $this->storeManagerMock = $this->getMockBuilder('Magento\\Store\\Model\\StoreManager')->disableOriginalConstructor()->getMock();
     $this->resourceMock = $this->getMockBuilder('Magento\\Sales\\Model\\Resource\\Quote')->disableOriginalConstructor()->getMock();
     $this->contextMock = $this->getMockBuilder('Magento\\Framework\\Model\\Context')->disableOriginalConstructor()->getMock();
     $this->customerFactoryMock = $this->getMockBuilder('Magento\\Customer\\Model\\CustomerFactory')->disableOriginalConstructor()->setMethods(['create'])->getMock();
     $this->addressConverterMock = $this->getMockBuilder('Magento\\Customer\\Model\\Address\\Converter')->disableOriginalConstructor()->getMock();
     $this->customerGroupServiceMock = $this->getMockBuilder('Magento\\Customer\\Service\\V1\\CustomerGroupService')->disableOriginalConstructor()->getMock();
     $this->contextMock->expects($this->any())->method('getEventDispatcher')->will($this->returnValue($this->eventManagerMock));
     $this->quoteItemCollectionFactoryMock = $this->getMock('Magento\\Sales\\Model\\Resource\\Quote\\Item\\CollectionFactory', ['create'], [], '', false);
     $this->quote = (new ObjectManager($this))->getObject('Magento\\Sales\\Model\\Quote', ['quoteAddressFactory' => $this->quoteAddressFactoryMock, 'storeManager' => $this->storeManagerMock, 'resource' => $this->resourceMock, 'context' => $this->contextMock, 'customerFactory' => $this->customerFactoryMock, 'addressConverter' => $this->addressConverterMock, 'customerGroupService' => $this->customerGroupServiceMock, 'objectFactory' => $this->objectFactoryMock, 'quoteItemCollectionFactory' => $this->quoteItemCollectionFactoryMock]);
 }