8
8
use Magento \Eav \Model \Entity \Attribute \Frontend \DefaultFrontend ;
9
9
use Magento \Eav \Model \Entity \Attribute \Source \BooleanFactory ;
10
10
use Magento \Framework \Serialize \Serializer \Json as Serializer ;
11
- use Magento \Store \Api \StoreResolverInterface ;
11
+ use Magento \Store \Model \StoreManagerInterface ;
12
+ use Magento \Store \Api \Data \StoreInterface ;
12
13
use Magento \Framework \App \CacheInterface ;
13
14
use Magento \Eav \Model \Entity \Attribute \AbstractAttribute ;
14
15
use Magento \Eav \Model \Entity \Attribute \Source \AbstractSource ;
@@ -31,9 +32,14 @@ class DefaultFrontendTest extends \PHPUnit_Framework_TestCase
31
32
private $ serializerMock ;
32
33
33
34
/**
34
- * @var StoreResolverInterface |\PHPUnit_Framework_MockObject_MockObject
35
+ * @var StoreManagerInterface |\PHPUnit_Framework_MockObject_MockObject
35
36
*/
36
- private $ storeResolverMock ;
37
+ private $ storeManagerMock ;
38
+
39
+ /**
40
+ * @var StoreInterface|\PHPUnit_Framework_MockObject_MockObject
41
+ */
42
+ private $ storeMock ;
37
43
38
44
/**
39
45
* @var CacheInterface|\PHPUnit_Framework_MockObject_MockObject
@@ -64,7 +70,9 @@ protected function setUp()
64
70
->getMock ();
65
71
$ this ->serializerMock = $ this ->getMockBuilder (Serializer::class)
66
72
->getMock ();
67
- $ this ->storeResolverMock = $ this ->getMockBuilder (StoreResolverInterface::class)
73
+ $ this ->storeManagerMock = $ this ->getMockBuilder (StoreManagerInterface::class)
74
+ ->getMockForAbstractClass ();
75
+ $ this ->storeMock = $ this ->getMockBuilder (StoreInterface::class)
68
76
->getMockForAbstractClass ();
69
77
$ this ->cacheMock = $ this ->getMockBuilder (CacheInterface::class)
70
78
->getMockForAbstractClass ();
@@ -83,7 +91,7 @@ protected function setUp()
83
91
[
84
92
'_attrBooleanFactory ' => $ this ->booleanFactory ,
85
93
'cache ' => $ this ->cacheMock ,
86
- 'storeResolver ' => $ this ->storeResolverMock ,
94
+ 'storeManager ' => $ this ->storeManagerMock ,
87
95
'serializer ' => $ this ->serializerMock ,
88
96
'_attribute ' => $ this ->attributeMock ,
89
97
'cacheTags ' => $ this ->cacheTags
@@ -188,8 +196,11 @@ public function testGetSelectOptions()
188
196
$ options = ['option1 ' , 'option2 ' ];
189
197
$ serializedOptions = "{['option1', 'option2']} " ;
190
198
191
- $ this ->storeResolverMock ->expects ($ this ->once ())
192
- ->method ('getCurrentStoreId ' )
199
+ $ this ->storeManagerMock ->expects ($ this ->once ())
200
+ ->method ('getStore ' )
201
+ ->willReturn ($ this ->storeMock );
202
+ $ this ->storeMock ->expects ($ this ->once ())
203
+ ->method ('getId ' )
193
204
->willReturn ($ storeId );
194
205
$ this ->attributeMock ->expects ($ this ->once ())
195
206
->method ('getAttributeCode ' )
0 commit comments