@@ -130,26 +130,6 @@ class ProductRepositoryTest extends \PHPUnit_Framework_TestCase
130
130
*/
131
131
protected $ objectManager ;
132
132
133
- /**
134
- * @var \Magento\Framework\Search\Request\Builder|\PHPUnit_Framework_MockObject_MockObject
135
- */
136
- protected $ requestBuilder ;
137
-
138
- /**
139
- * @var \Magento\Search\Model\SearchEngine|\PHPUnit_Framework_MockObject_MockObject
140
- */
141
- protected $ searchEngine ;
142
-
143
- /**
144
- * @var \Magento\Catalog\Model\SearchResponseBuilder|\PHPUnit_Framework_MockObject_MockObject
145
- */
146
- protected $ searchResponseBuilder ;
147
-
148
- /**
149
- * @var \Magento\Framework\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject
150
- */
151
- protected $ scopeConfig ;
152
-
153
133
/**
154
134
* @var \Magento\Store\Model\StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject
155
135
*/
@@ -241,22 +221,6 @@ protected function setUp()
241
221
['getLinkTypes ' ], [], '' , false );
242
222
$ this ->imageProcessorMock = $ this ->getMock ('Magento\Framework\Api\ImageProcessorInterface ' , [], [], '' , false );
243
223
244
- $ this ->requestBuilder = $ this ->getMockBuilder ('Magento\Framework\Search\Request\Builder ' )
245
- ->disableOriginalConstructor ()
246
- ->getMock ();
247
-
248
- $ this ->searchEngine = $ this ->getMockBuilder ('Magento\Search\Model\SearchEngine ' )
249
- ->disableOriginalConstructor ()
250
- ->getMock ();
251
-
252
- $ this ->searchResponseBuilder = $ this ->getMockBuilder ('Magento\Catalog\Model\SearchResponseBuilder ' )
253
- ->disableOriginalConstructor ()
254
- ->getMock ();
255
-
256
- $ this ->scopeConfig = $ this ->getMockBuilder ('Magento\Framework\App\Config\ScopeConfigInterface ' )
257
- ->disableOriginalConstructor ()
258
- ->getMockForAbstractClass ();
259
-
260
224
$ this ->storeManager = $ this ->getMockBuilder ('Magento\Store\Model\StoreManagerInterface ' )
261
225
->disableOriginalConstructor ()
262
226
->getMockForAbstractClass ();
@@ -280,10 +244,6 @@ protected function setUp()
280
244
'mimeTypeExtensionMap ' => $ this ->mimeTypeExtensionMapMock ,
281
245
'linkTypeProvider ' => $ this ->linkTypeProviderMock ,
282
246
'imageProcessor ' => $ this ->imageProcessorMock ,
283
- 'requestBuilder ' => $ this ->requestBuilder ,
284
- 'searchEngine ' => $ this ->searchEngine ,
285
- 'searchResponseBuilder ' => $ this ->searchResponseBuilder ,
286
- 'scopeConfig ' => $ this ->scopeConfig ,
287
247
'storeManager ' => $ this ->storeManager ,
288
248
]
289
249
);
@@ -1236,98 +1196,4 @@ public function testSaveExistingWithMediaGalleryEntries()
1236
1196
$ this ->model ->save ($ this ->productMock );
1237
1197
$ this ->assertEquals ($ expectedResult , $ this ->initializedProductMock ->getMediaGallery ('images ' ));
1238
1198
}
1239
-
1240
- public function testSearch ()
1241
- {
1242
- $ requestName = 'requestName ' ;
1243
- $ searchTerm = 'searchTerm ' ;
1244
- $ storeId = 333 ;
1245
- $ filterField = 'filterField ' ;
1246
- $ filterValue = 'filterValue ' ;
1247
- $ priceRangeCalculation = 'auto ' ;
1248
-
1249
- $ filter = $ this ->getMockBuilder ('Magento\Framework\Api\Filter ' )
1250
- ->disableOriginalConstructor ()
1251
- ->getMock ();
1252
- $ filter ->expects ($ this ->once ())
1253
- ->method ('getField ' )
1254
- ->willReturn ($ filterField );
1255
- $ filter ->expects ($ this ->once ())
1256
- ->method ('getValue ' )
1257
- ->willReturn ($ filterValue );
1258
-
1259
- $ filterGroup = $ this ->getMockBuilder ('Magento\Framework\Api\Search\FilterGroup ' )
1260
- ->disableOriginalConstructor ()
1261
- ->getMock ();
1262
- $ filterGroup ->expects ($ this ->once ())
1263
- ->method ('getFilters ' )
1264
- ->willReturn ([$ filter ]);
1265
-
1266
- $ searchCriteria = $ this ->getMockBuilder ('Magento\Framework\Api\Search\SearchCriteriaInterface ' )
1267
- ->disableOriginalConstructor ()
1268
- ->getMockForAbstractClass ();
1269
- $ searchCriteria ->expects ($ this ->once ())
1270
- ->method ('getRequestName ' )
1271
- ->willReturn ($ requestName );
1272
- $ searchCriteria ->expects ($ this ->once ())
1273
- ->method ('getSearchTerm ' )
1274
- ->willReturn ($ searchTerm );
1275
- $ searchCriteria ->expects ($ this ->once ())
1276
- ->method ('getFilterGroups ' )
1277
- ->willReturn ([$ filterGroup ]);
1278
-
1279
- $ store = $ this ->getMockBuilder ('Magento\Store\Model\Store ' )
1280
- ->disableOriginalConstructor ()
1281
- ->getMock ();
1282
- $ store ->expects ($ this ->once ())
1283
- ->method ('getId ' )
1284
- ->willReturn ($ storeId );
1285
-
1286
- $ searchResult = $ this ->getMockBuilder ('Magento\Framework\Api\Search\SearchResult ' )
1287
- ->disableOriginalConstructor ()
1288
- ->getMockForAbstractClass ();
1289
-
1290
- $ request = $ this ->getMockBuilder ('Magento\Framework\Search\RequestInterface ' )
1291
- ->disableOriginalConstructor ()
1292
- ->getMockForAbstractClass ();
1293
-
1294
- $ response = $ this ->getMockBuilder ('Magento\Framework\Search\ResponseInterface ' )
1295
- ->disableOriginalConstructor ()
1296
- ->getMockForAbstractClass ();
1297
-
1298
- $ this ->requestBuilder ->expects ($ this ->once ())
1299
- ->method ('setRequestName ' )
1300
- ->with ($ requestName );
1301
- $ this ->requestBuilder ->expects ($ this ->once ())
1302
- ->method ('bindDimension ' )
1303
- ->with ('scope ' , $ storeId );
1304
- $ this ->requestBuilder ->expects ($ this ->any ())
1305
- ->method ('bind ' );;
1306
- $ this ->requestBuilder ->expects ($ this ->once ())
1307
- ->method ('create ' )
1308
- ->willReturn ($ request );
1309
-
1310
- $ this ->searchEngine ->expects ($ this ->once ())
1311
- ->method ('search ' )
1312
- ->with ($ request )
1313
- ->willReturn ($ response );
1314
-
1315
- $ this ->searchResponseBuilder ->expects ($ this ->once ())
1316
- ->method ('build ' )
1317
- ->with ($ response )
1318
- ->willReturn ($ searchResult );
1319
-
1320
- $ this ->storeManager ->expects ($ this ->once ())
1321
- ->method ('getStore ' )
1322
- ->willReturn ($ store );
1323
-
1324
- $ this ->scopeConfig ->expects ($ this ->once ())
1325
- ->method ('getValue ' )
1326
- ->with (AlgorithmFactory::XML_PATH_RANGE_CALCULATION , ScopeInterface::SCOPE_STORE )
1327
- ->willReturn ($ priceRangeCalculation );
1328
-
1329
- $ searchResult = $ this ->model ->search ($ searchCriteria );
1330
-
1331
- $ this ->assertInstanceOf ('Magento\Framework\Api\Search\SearchResultInterface ' , $ searchResult );
1332
- }
1333
1199
}
0 commit comments