4
4
* Copyright © Magento, Inc. All rights reserved.
5
5
* See COPYING.txt for license details.
6
6
*/
7
+
8
+ declare (strict_types=1 );
9
+
7
10
namespace Magento \Multishipping \Test \Unit \Controller \Checkout ;
8
11
9
12
use Magento \Multishipping \Controller \Checkout \Plugin ;
@@ -30,16 +33,27 @@ protected function setUp()
30
33
$ this ->cartMock = $ this ->createMock (\Magento \Checkout \Model \Cart::class);
31
34
$ this ->quoteMock = $ this ->createPartialMock (
32
35
\Magento \Quote \Model \Quote::class,
33
- ['__wakeUp ' , 'setIsMultiShipping ' ]
36
+ ['__wakeUp ' , 'setIsMultiShipping ' , ' getIsMultiShipping ' ]
34
37
);
35
38
$ this ->cartMock ->expects ($ this ->once ())->method ('getQuote ' )->will ($ this ->returnValue ($ this ->quoteMock ));
36
39
$ this ->object = new \Magento \Multishipping \Controller \Checkout \Plugin ($ this ->cartMock );
37
40
}
38
41
39
- public function testExecuteTurnsOffMultishippingModeOnQuote ()
42
+ public function testExecuteTurnsOffMultishippingModeOnMultishippingQuote (): void
40
43
{
41
44
$ subject = $ this ->createMock (\Magento \Checkout \Controller \Index \Index::class);
45
+ $ this ->quoteMock ->expects ($ this ->once ())->method ('getIsMultiShipping ' )->willReturn (1 );
42
46
$ this ->quoteMock ->expects ($ this ->once ())->method ('setIsMultiShipping ' )->with (0 );
47
+ $ this ->cartMock ->expects ($ this ->once ())->method ('saveQuote ' );
48
+ $ this ->object ->beforeExecute ($ subject );
49
+ }
50
+
51
+ public function testExecuteTurnsOffMultishippingModeOnNotMultishippingQuote (): void
52
+ {
53
+ $ subject = $ this ->createMock (\Magento \Checkout \Controller \Index \Index::class);
54
+ $ this ->quoteMock ->expects ($ this ->once ())->method ('getIsMultiShipping ' )->willReturn (0 );
55
+ $ this ->quoteMock ->expects ($ this ->never ())->method ('setIsMultiShipping ' );
56
+ $ this ->cartMock ->expects ($ this ->never ())->method ('saveQuote ' );
43
57
$ this ->object ->beforeExecute ($ subject );
44
58
}
45
59
}
0 commit comments