10
10
use Magento \Customer \Api \Data \CustomerExtensionInterface ;
11
11
use Magento \Framework \Api \ExtensionAttributesFactory ;
12
12
use Magento \Newsletter \Model \ResourceModel \Subscriber ;
13
- use Magento \Store \Model \Store ;
14
- use Magento \Store \Model \StoreManagerInterface ;
15
13
16
14
class CustomerPluginTest extends \PHPUnit \Framework \TestCase
17
15
{
@@ -55,11 +53,6 @@ class CustomerPluginTest extends \PHPUnit\Framework\TestCase
55
53
*/
56
54
private $ customerMock ;
57
55
58
- /**
59
- * @var StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject
60
- */
61
- private $ storeManagerMock ;
62
-
63
56
protected function setUp ()
64
57
{
65
58
$ this ->subscriberFactory = $ this ->getMockBuilder (\Magento \Newsletter \Model \SubscriberFactory::class)
@@ -94,17 +87,14 @@ protected function setUp()
94
87
->setMethods (["getExtensionAttributes " ])
95
88
->disableOriginalConstructor ()
96
89
->getMockForAbstractClass ();
97
- $ this ->storeManagerMock = $ this ->createMock (StoreManagerInterface::class);
98
-
99
90
$ this ->subscriberFactory ->expects ($ this ->any ())->method ('create ' )->willReturn ($ this ->subscriber );
100
91
$ this ->objectManager = new \Magento \Framework \TestFramework \Unit \Helper \ObjectManager ($ this );
101
92
$ this ->plugin = $ this ->objectManager ->getObject (
102
93
\Magento \Newsletter \Model \Plugin \CustomerPlugin::class,
103
94
[
104
95
'subscriberFactory ' => $ this ->subscriberFactory ,
105
96
'extensionFactory ' => $ this ->extensionFactoryMock ,
106
- 'subscriberResource ' => $ this ->subscriberResourceMock ,
107
- 'storeManager ' => $ this ->storeManagerMock ,
97
+ 'subscriberResource ' => $ this ->subscriberResourceMock
108
98
]
109
99
);
110
100
}
@@ -208,7 +198,6 @@ public function testAfterGetByIdCreatesExtensionAttributesIfItIsNotSet(
208
198
) {
209
199
$ subject = $ this ->createMock (\Magento \Customer \Api \CustomerRepositoryInterface::class);
210
200
$ subscriber = [$ subscriberStatusKey => $ subscriberStatusValue ];
211
- $ this ->prepareStoreData ();
212
201
$ this ->extensionFactoryMock ->expects ($ this ->any ())
213
202
->method ('create ' )
214
203
->willReturn ($ this ->customerExtensionMock );
@@ -234,7 +223,6 @@ public function testAfterGetByIdSetsIsSubscribedFlagIfItIsNotSet()
234
223
{
235
224
$ subject = $ this ->createMock (\Magento \Customer \Api \CustomerRepositoryInterface::class);
236
225
$ subscriber = ['subscriber_id ' => 1 , 'subscriber_status ' => 1 ];
237
- $ this ->prepareStoreData ();
238
226
$ this ->customerMock ->expects ($ this ->any ())
239
227
->method ('getExtensionAttributes ' )
240
228
->willReturn ($ this ->customerExtensionMock );
@@ -267,17 +255,4 @@ public function afterGetByIdDataProvider()
267
255
[null , null , false ]
268
256
];
269
257
}
270
-
271
- /**
272
- * Prepare store information
273
- *
274
- * @return void
275
- */
276
- private function prepareStoreData ()
277
- {
278
- $ storeId = 1 ;
279
- $ storeMock = $ this ->createMock (Store::class);
280
- $ storeMock ->expects ($ this ->any ())->method ('getId ' )->willReturn ($ storeId );
281
- $ this ->storeManagerMock ->expects ($ this ->any ())->method ('getStore ' )->willReturn ($ storeMock );
282
- }
283
258
}
0 commit comments