@@ -266,33 +266,25 @@ public function testSaveThrowExceptionIfProvidedGroupDoesNotExist()
266266 */
267267 public function testGetList ()
268268 {
269- $ attributeSetId = 'filter ' ;
270-
271269 $ filterInterfaceMock = $ this ->getMockBuilder (\Magento \Framework \Api \Search \FilterGroup::class)
272270 ->disableOriginalConstructor ()
273271 ->setMethods ([
274272 'getField ' ,
275273 'getValue ' ,
276274 ])
277275 ->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 );
284276
285277 $ filterGroupMock = $ this ->getMockBuilder (\Magento \Framework \Api \Search \FilterGroup::class)
286278 ->disableOriginalConstructor ()
287279 ->getMock ();
288- $ filterGroupMock ->expects ($ this ->once ())
280+ $ filterGroupMock ->expects ($ this ->any ())
289281 ->method ('getFilters ' )
290282 ->willReturn ([$ filterInterfaceMock ]);
291283
292284 $ searchCriteriaMock = $ this ->getMockBuilder (\Magento \Framework \Api \SearchCriteriaInterface::class)
293285 ->disableOriginalConstructor ()
294286 ->getMock ();
295- $ searchCriteriaMock ->expects ($ this ->once ())
287+ $ searchCriteriaMock ->expects ($ this ->any ())
296288 ->method ('getFilterGroups ' )
297289 ->willReturn ([$ filterGroupMock ]);
298290
@@ -324,52 +316,6 @@ public function testGetList()
324316 $ this ->assertEquals ($ searchResultsMock , $ this ->model ->getList ($ searchCriteriaMock ));
325317 }
326318
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-
373319 /**
374320 * Test get
375321 *
0 commit comments