136 private $extensionAttributesJoinProcessorMock;
141 private $customerDataFactoryMock;
146 private $itemProcessor;
151 private $orderIncrementIdChecker;
158 $this->quoteAddressFactoryMock = $this->createPartialMock(
162 $this->quoteAddressMock = $this->createPartialMock(\
Magento\
Quote\Model\
Quote\Address::class, [
163 'isDeleted',
'getCollection',
'getId',
'getCustomerAddressId',
164 '__wakeup',
'getAddressType',
'getDeleteImmediately',
'validateMinimumAmount',
'setData' 166 $this->quoteAddressCollectionMock = $this->createMock(
169 $this->extensibleDataObjectConverterMock = $this->createPartialMock(
170 \
Magento\Framework\Api\ExtensibleDataObjectConverter::class,
173 $this->customerRepositoryMock = $this->getMockForAbstractClass(
174 \
Magento\Customer\Api\CustomerRepositoryInterface::class,
182 $this->objectCopyServiceMock = $this->createPartialMock(
184 [
'copyFieldsetToTarget']
186 $this->productMock = $this->createMock(\
Magento\Catalog\Model\Product::class);
187 $this->objectFactoryMock = $this->createPartialMock(\
Magento\Framework\
DataObject\Factory::class, [
'create']);
188 $this->quoteAddressFactoryMock->expects(
193 $this->returnValue($this->quoteAddressMock)
195 $this->quoteAddressMock->expects(
200 $this->returnValue($this->quoteAddressCollectionMock)
202 $this->eventManagerMock = $this->getMockBuilder(\
Magento\Framework\Event\Manager::class)
203 ->disableOriginalConstructor()
205 $this->storeManagerMock = $this->getMockBuilder(\
Magento\
Store\Model\StoreManager::class)
206 ->disableOriginalConstructor()
209 ->disableOriginalConstructor()
211 $this->contextMock = $this->getMockBuilder(\
Magento\Framework\Model\Context::class)
212 ->disableOriginalConstructor()
214 $this->customerFactoryMock = $this->getMockBuilder(\
Magento\Customer\Model\CustomerFactory::class)
215 ->disableOriginalConstructor()
216 ->setMethods([
'create'])
218 $this->groupRepositoryMock = $this->getMockBuilder(\
Magento\Customer\Api\GroupRepositoryInterface::class)
219 ->disableOriginalConstructor()
221 $this->contextMock->expects($this->any())
222 ->method(
'getEventDispatcher')
223 ->will($this->returnValue($this->eventManagerMock));
224 $this->quoteItemCollectionFactoryMock = $this->createPartialMock(
228 $this->quotePaymentCollectionFactoryMock = $this->createPartialMock(
232 $this->paymentFactoryMock = $this->createPartialMock(
236 $this->scopeConfig = $this->getMockBuilder(\
Magento\Framework\
App\Config::class)
237 ->disableOriginalConstructor()
240 $this->addressRepositoryMock = $this->getMockForAbstractClass(
241 \
Magento\Customer\Api\AddressRepositoryInterface::class,
247 $this->criteriaBuilderMock = $this->getMockBuilder(\
Magento\Framework\Api\SearchCriteriaBuilder::class)
248 ->disableOriginalConstructor()
251 $this->filterBuilderMock = $this->getMockBuilder(\
Magento\Framework\Api\FilterBuilder::class)
252 ->disableOriginalConstructor()
255 ->disableOriginalConstructor()
257 $this->extensionAttributesJoinProcessorMock = $this->createMock(
258 \
Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface::class
260 $this->customerDataFactoryMock = $this->createPartialMock(
261 \
Magento\Customer\Api\Data\CustomerInterfaceFactory::class,
264 $this->orderIncrementIdChecker = $this->createMock(\
Magento\Sales\Model\OrderIncrementIdChecker::class);
269 'quoteAddressFactory' => $this->quoteAddressFactoryMock,
270 'storeManager' => $this->storeManagerMock,
271 'resource' => $this->resourceMock,
272 'context' => $this->contextMock,
273 'customerFactory' => $this->customerFactoryMock,
274 'groupRepository' => $this->groupRepositoryMock,
275 'objectFactory' => $this->objectFactoryMock,
276 'addressRepository' => $this->addressRepositoryMock,
277 'criteriaBuilder' => $this->criteriaBuilderMock,
278 'filterBuilder' => $this->filterBuilderMock,
279 'quoteItemCollectionFactory' => $this->quoteItemCollectionFactoryMock,
280 'quotePaymentCollectionFactory' => $this->quotePaymentCollectionFactoryMock,
281 'quotePaymentFactory' => $this->paymentFactoryMock,
282 'scopeConfig' => $this->scopeConfig,
283 'extensibleDataObjectConverter' => $this->extensibleDataObjectConverterMock,
284 'customerRepository' => $this->customerRepositoryMock,
285 'objectCopyService' => $this->objectCopyServiceMock,
286 'extensionAttributesJoinProcessor' => $this->extensionAttributesJoinProcessorMock,
287 'customerDataFactory' => $this->customerDataFactoryMock,
288 'itemProcessor' => $this->itemProcessor,
289 'orderIncrementIdChecker' => $this->orderIncrementIdChecker,
291 'reserved_order_id' => 1000001,
304 $this->quoteAddressCollectionMock->expects(
309 $this->returnValue($this->quoteAddressCollectionMock)
311 $this->quoteAddressCollectionMock->expects(
316 $this->returnValue(
new \ArrayIterator(
$addresses))
319 $this->assertEquals($expected, $this->quote->isMultipleShippingAddresses());
328 \
Magento\Customer\Model\GroupManagement::NOT_LOGGED_IN_ID,
329 $this->quote->getCustomerGroupId(),
330 "Customer group ID is invalid" 340 $customerGroupId = 33;
341 $this->quote->setCustomerGroupId($customerGroupId);
344 $this->assertEquals($customerGroupId, $this->quote->getCustomerGroupId(),
"Customer group ID is invalid");
370 $shippingAddressMock = $this->createPartialMock(
372 [
'getAddressType',
'__wakeup',
'isDeleted']
375 $shippingAddressMock->expects($this->any())->method(
'getAddressType')->will($this->returnValue(
$type));
376 $shippingAddressMock->expects($this->any())->method(
'isDeleted')->will($this->returnValue(
false));
377 return $shippingAddressMock;
382 $storeMock = $this->getMockBuilder(\
Magento\
Store\Model\Store::class)
383 ->disableOriginalConstructor()
385 $storeMock->expects($this->once())
387 ->will($this->returnValue(
null));
388 $this->storeManagerMock->expects($this->once())
390 ->will($this->returnValue($storeMock));
392 $result = $this->quote->getStoreId();
408 $storeMock = $this->getMockBuilder(\
Magento\
Store\Model\Store::class)
409 ->disableOriginalConstructor()
411 $this->storeManagerMock->expects($this->once())
414 ->will($this->returnValue($storeMock));
417 $result = $this->quote->getStore();
425 $storeMock = $this->getMockBuilder(\
Magento\
Store\Model\Store::class)
426 ->disableOriginalConstructor()
428 $storeMock->expects($this->once())
430 ->will($this->returnValue(
$storeId));
432 $result = $this->quote->setStore($storeMock);
439 $storeIds = [1, 2, 3];
441 $websiteMock = $this->getMockBuilder(\
Magento\
Store\Model\Website::class)
442 ->disableOriginalConstructor()
444 $websiteMock->expects($this->once())
445 ->method(
'getStoreIds')
446 ->will($this->returnValue($storeIds));
448 $this->quote->setData(
'shared_store_ids', $sharedIds);
449 $this->quote->setWebsite($websiteMock);
450 $result = $this->quote->getSharedStoreIds();
451 $this->assertEquals($storeIds,
$result);
457 $storeIds = [1, 2, 3];
460 $websiteMock = $this->getMockBuilder(\
Magento\
Store\Model\Website::class)
461 ->disableOriginalConstructor()
463 $websiteMock->expects($this->once())
464 ->method(
'getStoreIds')
465 ->will($this->returnValue($storeIds));
467 $storeMock = $this->getMockBuilder(\
Magento\
Store\Model\Store::class)
468 ->disableOriginalConstructor()
470 $storeMock->expects($this->once())
471 ->method(
'getWebsite')
472 ->will($this->returnValue($websiteMock));
474 $this->storeManagerMock->expects($this->once())
477 ->will($this->returnValue($storeMock));
479 $this->quote->setData(
'shared_store_ids', $sharedIds);
481 $result = $this->quote->getSharedStoreIds();
482 $this->assertEquals($storeIds,
$result);
489 $this->resourceMock->expects($this->once())
490 ->method(
'loadActive')
493 $this->eventManagerMock->expects($this->any())
494 ->method(
'dispatch');
504 $this->resourceMock->expects($this->once())
505 ->method(
'loadByIdWithoutStore')
508 $this->eventManagerMock->expects($this->any())
509 ->method(
'dispatch');
521 $addressMock = $this->getMockForAbstractClass(
522 \
Magento\Customer\Api\Data\AddressInterface::class,
530 $addressMock->expects($this->any())
532 ->will($this->returnValue(
null));
536 $customerMock = $this->getMockForAbstractClass(
537 \
Magento\Customer\Api\Data\CustomerInterface::class,
542 $customerResultMock = $this->getMockForAbstractClass(
543 \
Magento\Customer\Api\Data\CustomerInterface::class,
548 $requestMock = $this->createMock(
549 \
Magento\Framework\DataObject::class
552 $this->extensibleDataObjectConverterMock->expects($this->any())
553 ->method(
'toFlatArray')
554 ->will($this->returnValue([
'customer_id' =>
$customerId]));
556 $this->customerRepositoryMock->expects($this->any())
558 ->will($this->returnValue($customerMock));
559 $this->customerDataFactoryMock->expects($this->any())
561 ->will($this->returnValue($customerMock));
562 $this->customerRepositoryMock->expects($this->never())
564 ->will($this->returnValue($customerMock));
565 $customerMock->expects($this->any())
566 ->method(
'getAddresses')
568 $this->objectFactoryMock->expects($this->once())
570 ->with($this->equalTo([
'customer_id' =>
$customerId]))
571 ->will($this->returnValue($requestMock));
572 $result = $this->quote->setCustomerAddressData([$addressMock]);
574 $this->assertEquals($customerResultMock, $this->quote->getCustomer());
581 $groupMock = $this->getMockForAbstractClass(\
Magento\Customer\Api\Data\GroupInterface::class, [],
'',
false);
582 $groupMock->expects($this->once())
583 ->method(
'getTaxClassId')
584 ->willReturn($taxClassId);
585 $this->groupRepositoryMock->expects($this->once())
588 ->will($this->returnValue($groupMock));
589 $this->quote->setData(
'customer_group_id',
$groupId);
590 $result = $this->quote->getCustomerTaxClassId();
591 $this->assertEquals($taxClassId,
$result);
597 $this->quoteAddressCollectionMock->expects($this->once())
598 ->method(
'setQuoteFilter')
600 ->will($this->returnSelf());
602 $this->quoteAddressMock->expects($this->once())
603 ->method(
'isDeleted')
604 ->will($this->returnValue(
false));
606 $iterator = new \ArrayIterator([$this->quoteAddressMock]);
607 $this->quoteAddressCollectionMock->expects($this->any())
608 ->method(
'getIterator')
611 $this->quote->setId(
$id);
612 $result = $this->quote->getAllAddresses();
613 $this->assertEquals([$this->quoteAddressMock],
$result);
622 $this->quoteAddressCollectionMock->expects($this->once())
623 ->method(
'setQuoteFilter')
625 ->will($this->returnSelf());
627 $this->quoteAddressMock->expects($this->once())
629 ->will($this->returnValue(
$id));
631 $iterator = new \ArrayIterator([$this->quoteAddressMock]);
632 $this->quoteAddressCollectionMock->expects($this->any())
633 ->method(
'getIterator')
636 $this->quote->setId(
$id);
637 $result = $this->quote->getAddressById($addressId);
639 $this->assertEquals((
bool)$expected, (
bool)
$result);
663 $this->quoteAddressCollectionMock->expects($this->once())
664 ->method(
'setQuoteFilter')
666 ->will($this->returnSelf());
668 $this->quoteAddressMock->expects($this->once())
669 ->method(
'isDeleted')
670 ->will($this->returnValue($isDeleted));
671 $this->quoteAddressMock->expects($this->once())
672 ->method(
'getCustomerAddressId')
673 ->will($this->returnValue($customerAddressId));
675 $iterator = new \ArrayIterator([$this->quoteAddressMock]);
676 $this->quoteAddressCollectionMock->expects($this->any())
677 ->method(
'getIterator')
680 $this->quote->setId(
$id);
681 $result = $this->quote->getAddressByCustomerAddressId(
$id);
683 $this->assertEquals((
bool)$expected, (
bool)
$result);
709 $this->quoteAddressCollectionMock->expects($this->once())
710 ->method(
'setQuoteFilter')
712 ->will($this->returnSelf());
714 $this->quoteAddressMock->expects($this->once())
715 ->method(
'isDeleted')
716 ->will($this->returnValue($isDeleted));
717 $this->quoteAddressMock->expects($this->once())
718 ->method(
'getCustomerAddressId')
719 ->will($this->returnValue($customerAddressId));
720 $this->quoteAddressMock->expects($this->once())
721 ->method(
'getAddressType')
722 ->will($this->returnValue($addressType));
724 $iterator = new \ArrayIterator([$this->quoteAddressMock]);
725 $this->quoteAddressCollectionMock->expects($this->any())
726 ->method(
'getIterator')
729 $this->quote->setId(
$id);
731 $result = $this->quote->getShippingAddressByCustomerAddressId(
$id);
732 $this->assertEquals($expected, (
bool)
$result);
741 [
false, \Magento\Customer\Model\Address\AbstractAddress::TYPE_SHIPPING, 1,
true],
742 [
false, \Magento\Customer\Model\Address\AbstractAddress::TYPE_SHIPPING, 2,
false],
750 $this->quoteAddressCollectionMock->expects($this->once())
751 ->method(
'setQuoteFilter')
753 ->will($this->returnSelf());
755 $this->quoteAddressMock->expects($this->once())
756 ->method(
'isDeleted')
758 $this->quoteAddressMock->expects($this->once())
760 ->will($this->returnValue(
$id));
762 $iterator = new \ArrayIterator([$this->quoteAddressMock]);
763 $this->quoteAddressCollectionMock->expects($this->any())
764 ->method(
'getIterator')
767 $this->quote->setId(
$id);
777 $this->quoteAddressCollectionMock->expects($this->once())
778 ->method(
'setQuoteFilter')
780 ->will($this->returnSelf());
782 $this->quoteAddressMock->expects($this->any())
783 ->method(
'getAddressType')
784 ->will($this->returnValue(\
Magento\Customer\Model\
Address\AbstractAddress::TYPE_SHIPPING));
785 $this->quoteAddressMock->expects($this->any())
786 ->method(
'getAddressType')
787 ->will($this->returnValue(\
Magento\Customer\Model\
Address\AbstractAddress::TYPE_SHIPPING));
788 $this->quoteAddressMock->expects($this->any())
789 ->method(
'isDeleted')
790 ->will($this->returnValue(
false));
791 $this->quoteAddressMock->expects($this->any())
793 ->will($this->returnSelf());
794 $this->quoteAddressMock->expects($this->once())
796 ->will($this->returnValue(
$id));
797 $this->quoteAddressMock->expects($this->once())
798 ->method(
'getDeleteImmediately')
799 ->will($this->returnValue(
true));
801 $iterator = new \ArrayIterator([
$id => $this->quoteAddressMock]);
802 $this->quoteAddressCollectionMock->expects($this->any())
803 ->method(
'getIterator')
805 $this->quoteAddressCollectionMock->expects($this->once())
806 ->method(
'removeItemByKey')
810 $this->quote->setId(
$id);
812 $result = $this->quote->removeAllAddresses();
821 $this->quote->addProduct($this->productMock,
'test');
826 $expectedResult =
'test_string';
827 $requestMock = $this->createMock(
828 \
Magento\Framework\DataObject::class
830 $this->objectFactoryMock->expects($this->once())
832 ->with($this->equalTo([
'qty' => 1]))
833 ->will($this->returnValue($requestMock));
835 $this->productMock->expects($this->once())
836 ->method(
'isSalable')
839 $typeInstanceMock = $this->createPartialMock(\
Magento\Catalog\Model\
Product\
Type\Simple::class, [
840 'prepareForCartAdvanced' 842 $typeInstanceMock->expects($this->once())
843 ->method(
'prepareForCartAdvanced')
844 ->will($this->returnValue($expectedResult));
845 $this->productMock->expects($this->once())
846 ->method(
'getTypeInstance')
847 ->will($this->returnValue($typeInstanceMock));
849 $result = $this->quote->addProduct($this->productMock,
null);
850 $this->assertEquals($expectedResult,
$result);
857 $expectedResult = $itemMock;
858 $requestMock = $this->createMock(
859 \
Magento\Framework\DataObject::class
861 $this->objectFactoryMock->expects($this->once())
863 ->with($this->equalTo([
'qty' => 1]))
864 ->will($this->returnValue($requestMock));
866 $typeInstanceMock = $this->createPartialMock(\
Magento\Catalog\Model\
Product\
Type\Simple::class, [
867 'prepareForCartAdvanced' 871 'getParentProductId',
872 'setStickWithinParent',
878 $itemMock->expects($this->any())
879 ->method(
'representProduct')
880 ->will($this->returnValue(
true));
882 $iterator = new \ArrayIterator([$itemMock]);
883 $collectionMock->expects($this->any())
884 ->method(
'getIterator')
887 $this->quoteItemCollectionFactoryMock->expects($this->once())
889 ->will($this->returnValue($collectionMock));
891 $this->productMock->expects($this->once())
892 ->method(
'isSalable')
895 $typeInstanceMock->expects($this->once())
896 ->method(
'prepareForCartAdvanced')
898 $this->productMock->expects($this->once())
899 ->method(
'getTypeInstance')
900 ->will($this->returnValue($typeInstanceMock));
902 $result = $this->quote->addProduct($this->productMock,
null);
903 $this->assertEquals($expectedResult,
$result);
910 $expectedResult = $itemMock;
911 $requestMock = $this->createMock(
912 \
Magento\Framework\DataObject::class
914 $this->objectFactoryMock->expects($this->once())
916 ->with($this->equalTo([
'qty' => 1]))
917 ->will($this->returnValue($requestMock));
919 $typeInstanceMock = $this->createPartialMock(\
Magento\Catalog\Model\
Product\
Type\Simple::class, [
920 'prepareForCartAdvanced' 924 'getParentProductId',
925 'setStickWithinParent',
931 $itemMock->expects($this->any())
932 ->method(
'representProduct')
933 ->will($this->returnValue(
false));
935 $iterator = new \ArrayIterator([$itemMock]);
936 $collectionMock->expects($this->any())
937 ->method(
'getIterator')
940 $this->quoteItemCollectionFactoryMock->expects($this->once())
942 ->will($this->returnValue($collectionMock));
944 $this->productMock->expects($this->once())
945 ->method(
'isSalable')
948 ->expects($this->once())
950 ->willReturn($itemMock);
951 $itemMock->expects($this->once())
952 ->method(
'setProduct');
953 $itemMock->expects($this->once())
954 ->method(
'setOptions');
955 $itemMock->expects($this->any())
957 ->with($this->quote);
958 $typeInstanceMock->expects($this->once())
959 ->method(
'prepareForCartAdvanced')
961 $this->productMock->expects($this->once())
962 ->method(
'getTypeInstance')
963 ->will($this->returnValue($typeInstanceMock));
965 $result = $this->quote->addProduct($this->productMock,
null);
966 $this->assertEquals($expectedResult,
$result);
980 $this->scopeConfig->expects($this->any())
981 ->method(
'isSetFlag')
982 ->will($this->returnValueMap($valueMap));
984 $this->quoteAddressMock->expects($this->once())
985 ->method(
'validateMinimumAmount')
988 $this->quoteAddressCollectionMock->expects($this->once())
989 ->method(
'setQuoteFilter')
990 ->willReturn([$this->quoteAddressMock]);
992 $this->assertTrue($this->quote->validateMinimumAmount());
1006 $this->scopeConfig->expects($this->any())
1007 ->method(
'isSetFlag')
1008 ->will($this->returnValueMap($valueMap));
1010 $this->quoteAddressMock->expects($this->once())
1011 ->method(
'validateMinimumAmount')
1012 ->willReturn(
false);
1014 $this->quoteAddressCollectionMock->expects($this->once())
1015 ->method(
'setQuoteFilter')
1016 ->willReturn([$this->quoteAddressMock]);
1018 $this->assertFalse($this->quote->validateMinimumAmount());
1023 $this->quote->setId(1);
1024 $payment = $this->createPartialMock(
1026 [
'setQuote',
'isDeleted',
'__wakeup']
1029 ->method(
'setQuote');
1031 ->method(
'isDeleted')
1032 ->willReturn(
false);
1033 $quotePaymentCollectionMock = $this->createPartialMock(
1035 [
'setQuoteFilter',
'getFirstItem']
1037 $quotePaymentCollectionMock->expects($this->once())
1038 ->method(
'setQuoteFilter')
1040 ->will($this->returnSelf());
1041 $quotePaymentCollectionMock->expects($this->once())
1042 ->method(
'getFirstItem')
1044 $this->quotePaymentCollectionFactoryMock->expects($this->once())
1046 ->willReturn($quotePaymentCollectionMock);
1048 $this->assertInstanceOf(\
Magento\
Quote\Model\
Quote\Payment::class, $this->quote->getPayment());
1053 $this->quote->setId(1);
1054 $payment = $this->createPartialMock(
1056 [
'setQuote',
'isDeleted',
'getId',
'__wakeup']
1058 $payment->expects($this->exactly(2))
1059 ->method(
'setQuote');
1061 ->method(
'isDeleted')
1066 $quotePaymentCollectionMock = $this->createPartialMock(
1068 [
'setQuoteFilter',
'getFirstItem']
1070 $quotePaymentCollectionMock->expects($this->once())
1071 ->method(
'setQuoteFilter')
1073 ->will($this->returnSelf());
1074 $quotePaymentCollectionMock->expects($this->once())
1075 ->method(
'getFirstItem')
1077 $this->quotePaymentCollectionFactoryMock->expects($this->once())
1079 ->willReturn($quotePaymentCollectionMock);
1081 $this->paymentFactoryMock->expects($this->once())
1085 $this->assertInstanceOf(\
Magento\
Quote\Model\
Quote\Payment::class, $this->quote->getPayment());
1091 $item->expects($this->once())
1092 ->method(
'setQuote');
1093 $item->expects($this->once())
1095 ->willReturn(
false);
1096 $itemsMock = $this->createPartialMock(
1098 [
'setQuote',
'addItem']
1100 $itemsMock->expects($this->once())
1101 ->method(
'setQuote');
1102 $itemsMock->expects($this->once())
1105 $this->quoteItemCollectionFactoryMock->expects($this->once())
1107 ->willReturn($itemsMock);
1108 $this->eventManagerMock->expects($this->once())
1109 ->method(
'dispatch');
1111 $this->quote->addItem(
$item);
1122 $currencyMock = $this->getMockBuilder(\
Magento\Directory\Model\Currency::class)
1123 ->disableOriginalConstructor()
1125 $currencyMock->expects($this->any())
1127 ->will($this->returnValue(
'test_code'));
1128 $currencyMock->expects($this->any())
1130 ->will($this->returnValue(
'test_rate'));
1131 $storeMock = $this->getMockBuilder(\
Magento\
Store\Model\Store::class)
1132 ->disableOriginalConstructor()
1134 $storeMock->expects($this->once())
1135 ->method(
'getBaseCurrency')
1136 ->will($this->returnValue($currencyMock));
1137 $storeMock->expects($this->once())
1138 ->method(
'getCurrentCurrency')
1139 ->will($this->returnValue($currencyMock));
1141 $this->storeManagerMock->expects($this->any())
1142 ->method(
'getStore')
1144 ->will($this->returnValue($storeMock));
1145 $this->quote->setStoreId(
$storeId);
1153 $itemMock = $this->createPartialMock(
1155 [
'isDeleted',
'getParentItemId',
'getProduct']
1157 $itemMock->expects($this->any())
1158 ->method(
'isDeleted')
1159 ->willReturn(
false);
1160 $itemMock->expects($this->any())
1161 ->method(
'getParentItemId')
1162 ->willReturn(
false);
1163 $itemMock->expects($this->any())
1164 ->method(
'getProduct')
1169 $collectionMock->expects($this->any())
1170 ->method(
'getIterator')
1172 $this->quoteItemCollectionFactoryMock->expects($this->once())
1174 ->will($this->returnValue($collectionMock));
1176 $this->quote->beforeSave();
1178 $this->assertNull($this->quote->getUpdatedAt());
1198 ->disableOriginalConstructor()
1199 ->setMethods([
'setQuote'])
1201 $this->quoteItemCollectionFactoryMock->expects($this->once())
1203 ->willReturn($itemCollectionMock);
1205 $this->extensionAttributesJoinProcessorMock->expects($this->once())
1210 $itemCollectionMock->expects($this->once())->method(
'setQuote')->with($this->quote);
1212 $this->quote->getItemsCollection();
1218 ->setMethods([
'isDeleted'])
1219 ->disableOriginalConstructor()
1221 $itemOneMock->expects($this->once())
1222 ->method(
'isDeleted')
1223 ->willReturn(
false);
1226 ->setMethods([
'isDeleted'])
1227 ->disableOriginalConstructor()
1229 $itemTwoMock->expects($this->once())
1230 ->method(
'isDeleted')
1233 $items = [$itemOneMock, $itemTwoMock];
1234 $itemResult = [$itemOneMock];
1235 $this->quote->setData(
'items_collection',
$items);
1237 $this->assertEquals($itemResult, $this->quote->getAllItems());
1250 $this->orderIncrementIdChecker
1251 ->expects($this->once())
1252 ->method(
'isIncrementIdUsed')
1253 ->with(1000001)->willReturn($isReservedOrderIdExist);
1254 $this->resourceMock->expects($this->any())->method(
'getReservedOrderId')->willReturn($reservedOrderId);
1255 $this->quote->reserveOrderId();
1256 $this->assertEquals($reservedOrderId, $this->quote->getReservedOrderId());
1265 'id_already_in_use' => [
true, 100002],
1266 'id_not_in_use' => [
false, 1000001],
testloadByIdWithoutStore()
testAddProductException()
static dataProviderGetAddress()
$quotePaymentCollectionFactoryMock
testReserveOrderId(bool $isReservedOrderIdExist, int $reservedOrderId)
static dataProviderShippingAddress()
testGetCustomerTaxClassId()
$quoteItemCollectionFactoryMock
testGetShippingAddressByCustomerAddressId($isDeleted, $addressType, $customerAddressId, $expected)
testValidateMinimumAmountNegative()
testGetPaymentIsNotDeleted()
isMultipleShippingAddressesDataProvider()
testGetSharedWebsiteStoreIds()
testGetCustomerGroupIdNotSet()
testGetAddressById($addressId, $expected)
$extensibleDataObjectConverterMock
testAddProductNoCandidates()
dataProviderForTestBeforeSaveIsVirtualQuote()
testGetPaymentIsDeleted()
static dataProviderGetAddressByCustomer()
testBeforeSaveIsVirtualQuote(array $productTypes, $expected)
testIsMultipleShippingAddresses($addresses, $expected)
testAddProductItemPreparation()
testValidateMinimumAmount()
reservedOrderIdDataProvider()
$quoteAddressCollectionMock
testSetCustomerAddressData()
testGetAddressByCustomerAddressId($isDeleted, $customerAddressId, $expected)