@@ -121,11 +121,6 @@ class QuoteManagementTest extends \PHPUnit_Framework_TestCase
121
121
*/
122
122
protected $ quoteMock ;
123
123
124
- /**
125
- * @var \Magento\Quote\Model\Quote\Validator\MinimumOrderAmount\ValidationMessage
126
- */
127
- private $ minimumAmountMessage ;
128
-
129
124
/**
130
125
* @var \PHPUnit_Framework_MockObject_MockObject
131
126
*/
@@ -223,8 +218,6 @@ protected function setUp()
223
218
'setCustomerGroupId ' ,
224
219
'assignCustomer ' ,
225
220
'getPayment ' ,
226
- 'getIsMultiShipping ' ,
227
- 'validateMinimumAmount '
228
221
],
229
222
[],
230
223
'' ,
@@ -256,14 +249,6 @@ protected function setUp()
256
249
false
257
250
);
258
251
259
- $ this ->minimumAmountMessage = $ this ->getMock (
260
- \Magento \Quote \Model \Quote \Validator \MinimumOrderAmount \ValidationMessage::class,
261
- ['getMessage ' ],
262
- [],
263
- '' ,
264
- false
265
- );
266
-
267
252
$ this ->quoteFactoryMock = $ this ->getMock (\Magento \Quote \Model \QuoteFactory::class, ['create ' ], [], '' , false );
268
253
$ this ->model = $ objectManager ->getObject (
269
254
\Magento \Quote \Model \QuoteManagement::class,
@@ -287,8 +272,7 @@ protected function setUp()
287
272
'checkoutSession ' => $ this ->checkoutSessionMock ,
288
273
'customerSession ' => $ this ->customerSessionMock ,
289
274
'accountManagement ' => $ this ->accountManagementMock ,
290
- 'quoteFactory ' => $ this ->quoteFactoryMock ,
291
- 'minimumAmountMessage ' => $ this ->minimumAmountMessage
275
+ 'quoteFactory ' => $ this ->quoteFactoryMock
292
276
]
293
277
);
294
278
@@ -721,10 +705,6 @@ public function testPlaceOrderIfCustomerIsGuest()
721
705
->willReturn (\Magento \Checkout \Model \Type \Onepage::METHOD_GUEST );
722
706
$ this ->quoteMock ->expects ($ this ->once ())->method ('setCustomerId ' )->with (null )->willReturnSelf ();
723
707
$ this ->quoteMock ->expects ($ this ->once ())->method ('setCustomerEmail ' )->with ($ email )->willReturnSelf ();
724
- $ this ->quoteMock ->expects ($ this ->once ())->method ('getIsMultiShipping ' )->willReturn (false );
725
- $ this ->quoteMock ->expects ($ this ->once ())->method ('validateMinimumAmount ' )->with (false )->willReturn (true );
726
-
727
- $ this ->minimumAmountMessage ->expects ($ this ->never ())->method ('getMessage ' );
728
708
729
709
$ addressMock = $ this ->getMock (\Magento \Quote \Model \Quote \Address::class, ['getEmail ' ], [], '' , false );
730
710
$ addressMock ->expects ($ this ->once ())->method ('getEmail ' )->willReturn ($ email );
@@ -759,8 +739,7 @@ public function testPlaceOrderIfCustomerIsGuest()
759
739
'checkoutSession ' => $ this ->checkoutSessionMock ,
760
740
'customerSession ' => $ this ->customerSessionMock ,
761
741
'accountManagement ' => $ this ->accountManagementMock ,
762
- 'quoteFactory ' => $ this ->quoteFactoryMock ,
763
- 'minimumAmountMessage ' => $ this ->minimumAmountMessage
742
+ 'quoteFactory ' => $ this ->quoteFactoryMock
764
743
]
765
744
);
766
745
$ orderMock = $ this ->getMock (
@@ -818,8 +797,7 @@ public function testPlaceOrder()
818
797
'checkoutSession ' => $ this ->checkoutSessionMock ,
819
798
'customerSession ' => $ this ->customerSessionMock ,
820
799
'accountManagement ' => $ this ->accountManagementMock ,
821
- 'quoteFactory ' => $ this ->quoteFactoryMock ,
822
- 'minimumAmountMessage ' => $ this ->minimumAmountMessage
800
+ 'quoteFactory ' => $ this ->quoteFactoryMock
823
801
]
824
802
);
825
803
$ orderMock = $ this ->getMock (
@@ -851,11 +829,6 @@ public function testPlaceOrder()
851
829
->method ('setCustomerIsGuest ' )
852
830
->with (true );
853
831
854
- $ this ->quoteMock ->expects ($ this ->once ())->method ('getIsMultiShipping ' )->willReturn (false );
855
- $ this ->quoteMock ->expects ($ this ->once ())->method ('validateMinimumAmount ' )->with (false )->willReturn (true );
856
-
857
- $ this ->minimumAmountMessage ->expects ($ this ->never ())->method ('getMessage ' );
858
-
859
832
$ service ->expects ($ this ->once ())->method ('submit ' )->willReturn ($ orderMock );
860
833
861
834
$ this ->quoteMock ->expects ($ this ->atLeastOnce ())->method ('getId ' )->willReturn ($ cartId );
@@ -883,67 +856,6 @@ public function testPlaceOrder()
883
856
$ this ->assertEquals ($ orderId , $ service ->placeOrder ($ cartId , $ paymentMethod ));
884
857
}
885
858
886
- /**
887
- * @expectedException \Magento\Framework\Exception\InputException
888
- * @expectedExceptionMessage Incorrect amount
889
- */
890
- public function testPlaceOrderWithViolationOfMinimumAmount ()
891
- {
892
- $ cartId = 323 ;
893
-
894
- $ this ->quoteMock ->expects ($ this ->once ())->method ('getIsMultiShipping ' )->willReturn (false );
895
- $ this ->quoteMock ->expects ($ this ->once ())->method ('validateMinimumAmount ' )->with (false )->willReturn (false );
896
-
897
- $ this ->minimumAmountMessage ->expects ($ this ->once ())
898
- ->method ('getMessage ' )
899
- ->willReturn (__ ('Incorrect amount ' ));
900
-
901
- $ this ->quoteRepositoryMock ->expects ($ this ->once ())
902
- ->method ('getActive ' )
903
- ->with ($ cartId )
904
- ->willReturn ($ this ->quoteMock );
905
-
906
- /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Quote\Model\QuoteManagement $service */
907
- $ service = $ this ->getMock (
908
- \Magento \Quote \Model \QuoteManagement::class,
909
- ['submit ' ],
910
- [
911
- 'eventManager ' => $ this ->eventManager ,
912
- 'quoteValidator ' => $ this ->quoteValidator ,
913
- 'orderFactory ' => $ this ->orderFactory ,
914
- 'orderManagement ' => $ this ->orderManagement ,
915
- 'customerManagement ' => $ this ->customerManagement ,
916
- 'quoteAddressToOrder ' => $ this ->quoteAddressToOrder ,
917
- 'quoteAddressToOrderAddress ' => $ this ->quoteAddressToOrderAddress ,
918
- 'quoteItemToOrderItem ' => $ this ->quoteItemToOrderItem ,
919
- 'quotePaymentToOrderPayment ' => $ this ->quotePaymentToOrderPayment ,
920
- 'userContext ' => $ this ->userContextMock ,
921
- 'quoteRepository ' => $ this ->quoteRepositoryMock ,
922
- 'customerRepository ' => $ this ->customerRepositoryMock ,
923
- 'customerModelFactory ' => $ this ->customerFactoryMock ,
924
- 'quoteAddressFactory ' => $ this ->quoteAddressFactory ,
925
- 'dataObjectHelper ' => $ this ->dataObjectHelperMock ,
926
- 'storeManager ' => $ this ->storeManagerMock ,
927
- 'checkoutSession ' => $ this ->checkoutSessionMock ,
928
- 'customerSession ' => $ this ->customerSessionMock ,
929
- 'accountManagement ' => $ this ->accountManagementMock ,
930
- 'quoteFactory ' => $ this ->quoteFactoryMock ,
931
- 'minimumAmountMessage ' => $ this ->minimumAmountMessage
932
- ]
933
- );
934
-
935
- $ service ->expects ($ this ->never ())->method ('submit ' );
936
-
937
- $ paymentMethod = $ this ->getMock (
938
- \Magento \Quote \Model \Quote \Payment::class,
939
- [],
940
- [],
941
- '' ,
942
- false
943
- );
944
- $ service ->placeOrder ($ cartId , $ paymentMethod );
945
- }
946
-
947
859
/**
948
860
* @param $isGuest
949
861
* @param $isVirtual
0 commit comments