11<?php
22/**
3- * Copyright © Magento, Inc. All rights reserved.
4- * See COPYING.txt for license details .
3+ * Copyright 2015 Adobe
4+ * All Rights Reserved .
55 */
66declare (strict_types=1 );
77
88namespace Magento \BundleImportExport \Test \Unit \Model \Import \Product \Type ;
99
1010use Magento \BundleImportExport \Model \Import \Product \Type \Bundle ;
1111use 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 ;
1214use 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 ;
1516use Magento \Framework \App \ResourceConnection ;
1617use Magento \Framework \App \ScopeInterface ;
1718use Magento \Framework \App \ScopeResolverInterface ;
@@ -34,46 +35,41 @@ class BundleTest extends AbstractImportTestCase
3435 /**
3536 * @var Bundle
3637 */
37- protected $ bundle ;
38+ private $ bundle ;
3839
3940 /**
4041 * @var ResourceConnection|MockObject
4142 */
42- protected $ resource ;
43+ private $ resource ;
4344
4445 /**
4546 * @var Select|MockObject
4647 */
47- protected $ select ;
48+ private $ select ;
4849
4950 /**
5051 * @var Product|MockObject
5152 */
52- protected $ entityModel ;
53+ private $ entityModel ;
5354
5455 /**
5556 * @var []
5657 */
57- protected $ params ;
58+ private $ params ;
5859
5960 /** @var AdapterInterface|MockObject
6061 */
61- protected $ connection ;
62+ private $ connection ;
6263
6364 /**
64- * @var MockObject
65+ * @var AttributeSetCollectionFactory| MockObject
6566 */
66- protected $ attrSetColFac ;
67+ private $ attrSetColFac ;
6768
6869 /**
69- * @var MockObject
70+ * @var ProductAttributeCollectionFactory| MockObject
7071 */
71- protected $ prodAttrColFac ;
72-
73- /**
74- * @var Collection|MockObject
75- */
76- protected $ setCollection ;
72+ private $ prodAttrColFac ;
7773
7874 /**
7975 * @var ScopeResolverInterface|MockObject
@@ -179,36 +175,17 @@ protected function setUp(): void
179175 );
180176 $ this ->resource ->expects ($ this ->any ())->method ('getConnection ' )->willReturn ($ this ->connection );
181177 $ 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 ([]);
203183 $ this ->prodAttrColFac ->expects ($ this ->any ())->method ('create ' )->willReturn ($ attrCollection );
204184 $ this ->params = [
205185 0 => $ this ->entityModel ,
206186 1 => 'bundle '
207187 ];
208- $ this ->scopeResolver = $ this ->getMockBuilder (ScopeResolverInterface::class)
209- ->disableOriginalConstructor ()
210- ->onlyMethods (['getScope ' ])
211- ->getMockForAbstractClass ();
188+ $ this ->scopeResolver = $ this ->createMock (ScopeResolverInterface::class);
212189
213190 $ objects = [
214191 [
0 commit comments