1
1
<?php
2
2
/**
3
- * Copyright © Magento, Inc. All rights reserved.
4
- * See COPYING.txt for license details .
3
+ * Copyright 2015 Adobe
4
+ * All Rights Reserved .
5
5
*/
6
6
declare (strict_types=1 );
7
7
8
8
namespace Magento \BundleImportExport \Test \Unit \Model \Import \Product \Type ;
9
9
10
10
use Magento \BundleImportExport \Model \Import \Product \Type \Bundle ;
11
11
use Magento \Catalog \Api \Data \ProductInterface ;
12
+ use Magento \Catalog \Model \ResourceModel \Product \Attribute \Collection as ProductAttributeCollection ;
13
+ use Magento \Catalog \Model \ResourceModel \Product \Attribute \CollectionFactory as ProductAttributeCollectionFactory ;
12
14
use Magento \CatalogImportExport \Model \Import \Product ;
13
- use Magento \Eav \Model \ResourceModel \Entity \Attribute \Set \Collection ;
14
- use Magento \Eav \Model \ResourceModel \Entity \Attribute \Set \CollectionFactory ;
15
+ use Magento \Eav \Model \ResourceModel \Entity \Attribute \Set \CollectionFactory as AttributeSetCollectionFactory ;
15
16
use Magento \Framework \App \ResourceConnection ;
16
17
use Magento \Framework \App \ScopeInterface ;
17
18
use Magento \Framework \App \ScopeResolverInterface ;
@@ -34,46 +35,41 @@ class BundleTest extends AbstractImportTestCase
34
35
/**
35
36
* @var Bundle
36
37
*/
37
- protected $ bundle ;
38
+ private $ bundle ;
38
39
39
40
/**
40
41
* @var ResourceConnection|MockObject
41
42
*/
42
- protected $ resource ;
43
+ private $ resource ;
43
44
44
45
/**
45
46
* @var Select|MockObject
46
47
*/
47
- protected $ select ;
48
+ private $ select ;
48
49
49
50
/**
50
51
* @var Product|MockObject
51
52
*/
52
- protected $ entityModel ;
53
+ private $ entityModel ;
53
54
54
55
/**
55
56
* @var []
56
57
*/
57
- protected $ params ;
58
+ private $ params ;
58
59
59
60
/** @var AdapterInterface|MockObject
60
61
*/
61
- protected $ connection ;
62
+ private $ connection ;
62
63
63
64
/**
64
- * @var MockObject
65
+ * @var AttributeSetCollectionFactory| MockObject
65
66
*/
66
- protected $ attrSetColFac ;
67
+ private $ attrSetColFac ;
67
68
68
69
/**
69
- * @var MockObject
70
+ * @var ProductAttributeCollectionFactory| MockObject
70
71
*/
71
- protected $ prodAttrColFac ;
72
-
73
- /**
74
- * @var Collection|MockObject
75
- */
76
- protected $ setCollection ;
72
+ private $ prodAttrColFac ;
77
73
78
74
/**
79
75
* @var ScopeResolverInterface|MockObject
@@ -179,36 +175,17 @@ protected function setUp(): void
179
175
);
180
176
$ this ->resource ->expects ($ this ->any ())->method ('getConnection ' )->willReturn ($ this ->connection );
181
177
$ this ->resource ->expects ($ this ->any ())->method ('getTableName ' )->willReturn ('tableName ' );
182
- $ this ->attrSetColFac = $ this ->createPartialMock (
183
- CollectionFactory::class,
184
- ['create ' ]
185
- );
186
- $ this ->setCollection = $ this ->createPartialMock (
187
- Collection::class,
188
- ['setEntityTypeFilter ' ]
189
- );
190
- $ this ->attrSetColFac ->expects ($ this ->any ())->method ('create ' )->willReturn (
191
- $ this ->setCollection
192
- );
193
- $ this ->setCollection ->expects ($ this ->any ())
194
- ->method ('setEntityTypeFilter ' )
195
- ->willReturn ([]);
196
- $ this ->prodAttrColFac = $ this ->createPartialMock (
197
- \Magento \Catalog \Model \ResourceModel \Product \Attribute \CollectionFactory::class,
198
- ['create ' ]
199
- );
200
- $ attrCollection =
201
- $ this ->createMock (\Magento \Catalog \Model \ResourceModel \Product \Attribute \Collection::class);
202
- $ attrCollection ->expects ($ this ->any ())->method ('addFieldToFilter ' )->willReturn ([]);
178
+ $ this ->attrSetColFac = $ this ->createMock (AttributeSetCollectionFactory::class);
179
+ $ this ->prodAttrColFac = $ this ->createMock (ProductAttributeCollectionFactory::class);
180
+ $ attrCollection = $ this ->createMock (ProductAttributeCollection::class);
181
+ $ attrCollection ->expects ($ this ->any ())->method ('addFieldToFilter ' )->willReturnSelf ();
182
+ $ attrCollection ->expects ($ this ->any ())->method ('getItems ' )->willReturn ([]);
203
183
$ this ->prodAttrColFac ->expects ($ this ->any ())->method ('create ' )->willReturn ($ attrCollection );
204
184
$ this ->params = [
205
185
0 => $ this ->entityModel ,
206
186
1 => 'bundle '
207
187
];
208
- $ this ->scopeResolver = $ this ->getMockBuilder (ScopeResolverInterface::class)
209
- ->disableOriginalConstructor ()
210
- ->onlyMethods (['getScope ' ])
211
- ->getMockForAbstractClass ();
188
+ $ this ->scopeResolver = $ this ->createMock (ScopeResolverInterface::class);
212
189
213
190
$ objects = [
214
191
[
0 commit comments