@@ -266,33 +266,25 @@ public function testSaveThrowExceptionIfProvidedGroupDoesNotExist()
266
266
*/
267
267
public function testGetList ()
268
268
{
269
- $ attributeSetId = 'filter ' ;
270
-
271
269
$ filterInterfaceMock = $ this ->getMockBuilder (\Magento \Framework \Api \Search \FilterGroup::class)
272
270
->disableOriginalConstructor ()
273
271
->setMethods ([
274
272
'getField ' ,
275
273
'getValue ' ,
276
274
])
277
275
->getMock ();
278
- $ filterInterfaceMock ->expects ($ this ->once ())
279
- ->method ('getField ' )
280
- ->willReturn ('attribute_set_id ' );
281
- $ filterInterfaceMock ->expects ($ this ->once ())
282
- ->method ('getValue ' )
283
- ->willReturn ($ attributeSetId );
284
276
285
277
$ filterGroupMock = $ this ->getMockBuilder (\Magento \Framework \Api \Search \FilterGroup::class)
286
278
->disableOriginalConstructor ()
287
279
->getMock ();
288
- $ filterGroupMock ->expects ($ this ->once ())
280
+ $ filterGroupMock ->expects ($ this ->any ())
289
281
->method ('getFilters ' )
290
282
->willReturn ([$ filterInterfaceMock ]);
291
283
292
284
$ searchCriteriaMock = $ this ->getMockBuilder (\Magento \Framework \Api \SearchCriteriaInterface::class)
293
285
->disableOriginalConstructor ()
294
286
->getMock ();
295
- $ searchCriteriaMock ->expects ($ this ->once ())
287
+ $ searchCriteriaMock ->expects ($ this ->any ())
296
288
->method ('getFilterGroups ' )
297
289
->willReturn ([$ filterGroupMock ]);
298
290
@@ -324,52 +316,6 @@ public function testGetList()
324
316
$ this ->assertEquals ($ searchResultsMock , $ this ->model ->getList ($ searchCriteriaMock ));
325
317
}
326
318
327
- /**
328
- * Test get list with invalid input exception
329
- *
330
- * @expectedException \Magento\Framework\Exception\InputException
331
- * @expectedExceptionMessage attribute_set_id is a required field.
332
- * @throws \Magento\Framework\Exception\InputException
333
- * @throws \Magento\Framework\Exception\NoSuchEntityException
334
- * @return void
335
- */
336
- public function testGetListWithInvalidInputException ()
337
- {
338
- $ searchCriteriaMock = $ this ->createMock (\Magento \Framework \Api \SearchCriteriaInterface::class);
339
- $ searchCriteriaMock ->expects ($ this ->once ())->method ('getFilterGroups ' )->willReturn ([]);
340
- $ this ->model ->getList ($ searchCriteriaMock );
341
- }
342
-
343
- /**
344
- * Test get list with no such entity exception
345
- *
346
- * @expectedException \Magento\Framework\Exception\NoSuchEntityException
347
- * @expectedExceptionMessage No such entity with attributeSetId = filter
348
- * @throws \Magento\Framework\Exception\InputException
349
- * @throws \Magento\Framework\Exception\NoSuchEntityException
350
- * @return void
351
- */
352
- public function testGetListWithNoSuchEntityException ()
353
- {
354
- $ attributeSetId = 'filter ' ;
355
- $ searchCriteriaMock = $ this ->createMock (\Magento \Framework \Api \SearchCriteriaInterface::class);
356
- $ filterGroupMock = $ this ->createMock (\Magento \Framework \Api \Search \FilterGroup::class);
357
- $ filterInterfaceMock = $ this ->createMock (\Magento \Framework \Api \Filter::class);
358
-
359
- $ searchCriteriaMock ->expects ($ this ->once ())->method ('getFilterGroups ' )->willReturn ([$ filterGroupMock ]);
360
-
361
- $ filterGroupMock ->expects ($ this ->once ())->method ('getFilters ' )->willReturn ([$ filterInterfaceMock ]);
362
- $ filterInterfaceMock ->expects ($ this ->once ())->method ('getField ' )->willReturn ('attribute_set_id ' );
363
- $ filterInterfaceMock ->expects ($ this ->once ())->method ('getValue ' )->willReturn ($ attributeSetId );
364
-
365
- $ searchCriteriaMock ->expects ($ this ->once ())->method ('getFilterGroups ' )->willReturn ([]);
366
- $ this ->setRepositoryMock ->expects ($ this ->once ())
367
- ->method ('get ' )
368
- ->with ($ attributeSetId )
369
- ->willThrowException (new \Exception ());
370
- $ this ->model ->getList ($ searchCriteriaMock );
371
- }
372
-
373
319
/**
374
320
* Test get
375
321
*
0 commit comments