20
20
use Magento \Sales \Model \Order ;
21
21
use Magento \Sales \Model \Order \Address ;
22
22
use PHPUnit_Framework_MockObject_MockObject as MockObject ;
23
+ use Magento \Backend \Model \Session \Quote as QuoteSession ;
24
+ use Magento \Sales \Model \AdminOrder \Create ;
23
25
24
26
/**
25
27
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -51,6 +53,16 @@ class FormTest extends \PHPUnit\Framework\TestCase
51
53
*/
52
54
private $ countriesCollection ;
53
55
56
+ /**
57
+ * @var Create|MockObject
58
+ */
59
+ private $ orderCreate ;
60
+
61
+ /**
62
+ * @var QuoteSession|MockObject
63
+ */
64
+ private $ sessionQuote ;
65
+
54
66
protected function setUp ()
55
67
{
56
68
$ objectManager = new ObjectManager ($ this );
@@ -61,6 +73,15 @@ protected function setUp()
61
73
$ this ->countriesCollection = $ this ->createMock (
62
74
Collection::class
63
75
);
76
+ $ this ->sessionQuote = $ this ->getMockBuilder (QuoteSession::class)
77
+ ->disableOriginalConstructor ()
78
+ ->setMethods (['getStoreId ' , 'getStore ' ])
79
+ ->getMock ();
80
+ $ this ->orderCreate = $ this ->getMockBuilder (Create::class)
81
+ ->disableOriginalConstructor ()
82
+ ->getMock ();
83
+ $ this ->orderCreate ->method ('getSession ' )
84
+ ->willReturn ($ this ->sessionQuote );
64
85
65
86
$ this ->addressBlock = $ objectManager ->getObject (
66
87
Form::class,
@@ -69,6 +90,8 @@ protected function setUp()
69
90
'_customerFormFactory ' => $ this ->customerFormFactory ,
70
91
'_coreRegistry ' => $ this ->coreRegistry ,
71
92
'countriesCollection ' => $ this ->countriesCollection ,
93
+ 'sessionQuote ' => $ this ->sessionQuote ,
94
+ '_orderCreate ' => $ this ->orderCreate
72
95
]
73
96
);
74
97
}
@@ -108,6 +131,8 @@ public function testGetForm()
108
131
->willReturn ($ order );
109
132
$ order ->method ('getStoreId ' )
110
133
->willReturn ($ storeId );
134
+ $ this ->sessionQuote ->method ('getStoreId ' )
135
+ ->willReturn ($ storeId );
111
136
$ this ->countriesCollection ->method ('loadByStore ' )
112
137
->with ($ storeId )
113
138
->willReturn ($ this ->countriesCollection );
0 commit comments